New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@markuplint/ml-core

Package Overview
Dependencies
Maintainers
1
Versions
203
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@markuplint/ml-core - npm Package Compare versions

Comparing version 3.0.0-alpha.66 to 3.0.0-canary.5

6

lib/configs.js

@@ -25,8 +25,12 @@ "use strict";

};
var _a;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getPreset = void 0;
async function getPreset(name) {
const json = await Promise.resolve().then(() => __importStar(require(`@markuplint/config-presets/${name}.json`)));
const json = await (_a = `@markuplint/config-presets/preset.${name}.json`, Promise.resolve().then(() => __importStar(require(_a)))).catch(() => new Error());
if (json instanceof Error) {
throw new ReferenceError(`Preset markuplint:${name} is not found`);
}
return json.default;
}
exports.getPreset = getPreset;

4

lib/ml-core.d.ts

@@ -5,3 +5,3 @@ import type { MLFabric } from './types';

import { Document } from './ml-dom';
export declare type MLCoreParams = {
export type MLCoreParams = {
sourceCode: string;

@@ -13,4 +13,4 @@ filename: string;

#private;
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, }: MLCoreParams);
get document(): ParserError | Document<RuleConfigValue, unknown>;
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, filename, debug }: MLCoreParams);
setCode(sourceCode: string): void;

@@ -17,0 +17,0 @@ update({ parser, ruleset, rules, locale, schemas, parserOptions }: Partial<MLFabric>): void;

"use strict";
var _MLCore_ast, _MLCore_document, _MLCore_filename, _MLCore_ignoreFrontMatter, _MLCore_locale, _MLCore_parser, _MLCore_rules, _MLCore_ruleset, _MLCore_schemas, _MLCore_sourceCode;
var _MLCore_ast, _MLCore_document, _MLCore_filename, _MLCore_locale, _MLCore_parser, _MLCore_parserOptions, _MLCore_pretenders, _MLCore_rules, _MLCore_ruleset, _MLCore_schemas, _MLCore_sourceCode;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -11,3 +11,3 @@ exports.MLCore = void 0;

class MLCore {
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, filename, debug }) {
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, }) {
var _a, _b, _c;

@@ -17,5 +17,6 @@ _MLCore_ast.set(this, null);

_MLCore_filename.set(this, void 0);
_MLCore_ignoreFrontMatter.set(this, void 0);
_MLCore_locale.set(this, void 0);
_MLCore_parser.set(this, void 0);
_MLCore_parserOptions.set(this, void 0);
_MLCore_pretenders.set(this, void 0);
_MLCore_rules.set(this, void 0);

@@ -30,3 +31,3 @@ _MLCore_ruleset.set(this, void 0);

tslib_1.__classPrivateFieldSet(this, _MLCore_sourceCode, sourceCode, "f");
tslib_1.__classPrivateFieldSet(this, _MLCore_ignoreFrontMatter, !!parserOptions.ignoreFrontMatter, "f");
tslib_1.__classPrivateFieldSet(this, _MLCore_parserOptions, parserOptions, "f");
tslib_1.__classPrivateFieldSet(this, _MLCore_ruleset, {

@@ -41,2 +42,3 @@ rules: (_a = ruleset.rules) !== null && _a !== void 0 ? _a : {},

tslib_1.__classPrivateFieldSet(this, _MLCore_rules, rules, "f");
tslib_1.__classPrivateFieldSet(this, _MLCore_pretenders, pretenders, "f");
this._parse();

@@ -64,3 +66,5 @@ this._createDocument();

tslib_1.__classPrivateFieldSet(this, _MLCore_schemas, schemas !== null && schemas !== void 0 ? schemas : tslib_1.__classPrivateFieldGet(this, _MLCore_schemas, "f"), "f");
if (parserOptions && parserOptions.ignoreFrontMatter !== tslib_1.__classPrivateFieldGet(this, _MLCore_ignoreFrontMatter, "f")) {
if (parserOptions &&
(parserOptions.ignoreFrontMatter !== tslib_1.__classPrivateFieldGet(this, _MLCore_parserOptions, "f").ignoreFrontMatter ||
parserOptions.authoredElementName !== tslib_1.__classPrivateFieldGet(this, _MLCore_parserOptions, "f").authoredElementName)) {
this._parse();

@@ -138,2 +142,4 @@ }

endTag: tslib_1.__classPrivateFieldGet(this, _MLCore_parser, "f").endTag,
booleanish: tslib_1.__classPrivateFieldGet(this, _MLCore_parser, "f").booleanish,
pretenders: tslib_1.__classPrivateFieldGet(this, _MLCore_pretenders, "f"),
}), "f");

@@ -152,3 +158,3 @@ }

try {
tslib_1.__classPrivateFieldSet(this, _MLCore_ast, tslib_1.__classPrivateFieldGet(this, _MLCore_parser, "f").parse(tslib_1.__classPrivateFieldGet(this, _MLCore_sourceCode, "f"), 0, 0, 0, tslib_1.__classPrivateFieldGet(this, _MLCore_ignoreFrontMatter, "f")), "f");
tslib_1.__classPrivateFieldSet(this, _MLCore_ast, tslib_1.__classPrivateFieldGet(this, _MLCore_parser, "f").parse(tslib_1.__classPrivateFieldGet(this, _MLCore_sourceCode, "f"), tslib_1.__classPrivateFieldGet(this, _MLCore_parserOptions, "f")), "f");
}

@@ -168,2 +174,2 @@ catch (err) {

exports.MLCore = MLCore;
_MLCore_ast = new WeakMap(), _MLCore_document = new WeakMap(), _MLCore_filename = new WeakMap(), _MLCore_ignoreFrontMatter = new WeakMap(), _MLCore_locale = new WeakMap(), _MLCore_parser = new WeakMap(), _MLCore_rules = new WeakMap(), _MLCore_ruleset = new WeakMap(), _MLCore_schemas = new WeakMap(), _MLCore_sourceCode = new WeakMap();
_MLCore_ast = new WeakMap(), _MLCore_document = new WeakMap(), _MLCore_filename = new WeakMap(), _MLCore_locale = new WeakMap(), _MLCore_parser = new WeakMap(), _MLCore_parserOptions = new WeakMap(), _MLCore_pretenders = new WeakMap(), _MLCore_rules = new WeakMap(), _MLCore_ruleset = new WeakMap(), _MLCore_schemas = new WeakMap(), _MLCore_sourceCode = new WeakMap();
import type { MLElement } from '../node/element';
export declare function getAccname(el: MLElement<any, any>): string;
import type { ARIAVersion } from '@markuplint/ml-spec';
export declare function getAccname(el: MLElement<any, any>, version: ARIAVersion): string;

@@ -7,3 +7,31 @@ "use strict";

const accnameLog = debug_1.log.extend('accname');
function getAccname(el) {
function getAccname(el, version) {
let accname = safeGet(el);
if (accname) {
return accname;
}
accname = getAccnameFromPretender(el);
if (accname) {
return accname;
}
if (isHidden(el)) {
return '';
}
if (isFromContent(el, version)) {
return Array.from(el.childNodes)
.map(child => {
if (child.is(child.ELEMENT_NODE)) {
return getAccname(child, version);
}
if (child.is(child.TEXT_NODE)) {
return child.textContent || '';
}
return '';
})
.join('');
}
return '';
}
exports.getAccname = getAccname;
function safeGet(el) {
try {

@@ -19,2 +47,23 @@ const name = (0, ml_spec_1.getAccname)(el);

}
exports.getAccname = getAccname;
function getAccnameFromPretender(el) {
var _a, _b;
if (((_a = el.pretenderContext) === null || _a === void 0 ? void 0 : _a.type) === 'pretender' && ((_b = el.pretenderContext.aria) === null || _b === void 0 ? void 0 : _b.name)) {
if (typeof el.pretenderContext.aria.name === 'boolean') {
return 'some-name(Pretender Options)';
}
const attrName = el.pretenderContext.aria.name.fromAttr;
const attrValue = el.getAttributePretended(attrName);
if (attrValue) {
return attrValue;
}
}
return '';
}
function isHidden(el) {
return el.getAttribute('aria-hidden') === 'true' || el.hasAttribute('hidden');
}
function isFromContent(el, version) {
var _a;
const role = (0, ml_spec_1.getComputedRole)(el.ownerMLDocument.specs, el, version);
return !!((_a = role.role) === null || _a === void 0 ? void 0 : _a.accessibleNameFromContent);
}
import type { MLDocument } from '../node/document';
import type { MappedNode } from '../node/types';
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
import type { RuleConfigValue } from '@markuplint/ml-config';
export declare function createNode<N extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(astNode: N, document: MLDocument<T, O>): MappedNode<N, T, O>;
export declare function createNode<N extends MLASTAbstractNode, T extends RuleConfigValue, O = null>(astNode: N, document: MLDocument<T, O>): MappedNode<N, T, O>;

@@ -28,4 +28,4 @@ "use strict";

}
throw new TypeError(`Invalid AST node typs "${astNode.type}"`);
throw new TypeError(`Invalid AST node types "${astNode.type}"`);
}
exports.createNode = createNode;

@@ -15,5 +15,5 @@ "use strict";

r.push(` namespaceURI: ${!!n.namespaceURI}`);
r.push(` elementType: ${n.elementType}`);
r.push(` isInFragmentDocument: ${!!n.isInFragmentDocument}`);
r.push(` isForeignElement: ${!!n.isForeignElement}`);
r.push(` isCustomElement: ${!!n.isCustomElement}`);
if (withAttr) {

@@ -20,0 +20,0 @@ r.push(...attributesToDebugMaps(n.attributes)

@@ -12,8 +12,8 @@ import type { MLNode } from '../node/node';

readonly line: number;
constructor(originTextNode: MLText<any, any>, raw: string, line: number, parentNode: MLNode<any, any>);
get raw(): string;
get type(): 'tab' | 'space' | 'mixed' | 'none';
get width(): number;
constructor(originTextNode: MLText<any, any>, raw: string, line: number, parentNode: MLNode<any, any>);
fix(raw: string): void;
}
export {};
import type { MLNode } from '../node/node';
import type { RuleConfigValue } from '@markuplint/ml-config';
export declare type Walker<T extends RuleConfigValue, O = null, N = MLNode<T, O>> = (node: N) => void | Promise<void> | Promise<void>[];
export declare type SyncWalker<T extends RuleConfigValue, O = null, N = MLNode<T, O>> = (node: N) => void;
export type Walker<T extends RuleConfigValue, O = null, N = MLNode<T, O>> = (node: N) => void | Promise<void> | Promise<void>[];
export type SyncWalker<T extends RuleConfigValue, O = null, N = MLNode<T, O>> = (node: N) => void;
export declare function syncWalk<T extends RuleConfigValue, O = null>(nodeList: ReadonlyArray<MLNode<T, O>>, walker: SyncWalker<T, O>): void;
export declare function sequentialWalker<T extends RuleConfigValue, O = null, N = MLNode<T, O>>(list: ReadonlyArray<N>, walker: Walker<T, O, N>): Promise<void>;

@@ -8,2 +8,3 @@ export type { MLAttr as Attr } from './node/attr';

export type { MLText as Text } from './node/text';
export type { MLChildNode as ChildNode } from './node/child-node';
export { MLDocument as Document } from './node/document';

@@ -34,2 +34,3 @@ import type { MLElement } from './element';

readonly valueType: 'string' | 'number' | 'boolean' | 'code';
constructor(astToken: MLASTAttr, ownElement: MLElement<T, O>);
/**

@@ -86,2 +87,6 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

/**
* @implements `@markuplint/ml-core` API: `MLAttr`
*/
get tokenList(): MLDomTokenList | null;
/**
* @implements DOM API: `Attr`

@@ -94,8 +99,3 @@ * @see https://dom.spec.whatwg.org/#dom-attr-value

*/
get tokenList(): MLDomTokenList | null;
constructor(astToken: MLASTAttr, ownElement: MLElement<T, O>);
/**
* @implements `@markuplint/ml-core` API: `MLAttr`
*/
toNormalizeString(): string;
}
"use strict";
var _MLAttr_potentialName, _MLAttr_potentialValue;
var _MLAttr_localName, _MLAttr_namespaceURI, _MLAttr_potentialName, _MLAttr_potentialValue;
Object.defineProperty(exports, "__esModule", { value: true });
exports.MLAttr = void 0;
const tslib_1 = require("tslib");
const ml_spec_1 = require("@markuplint/ml-spec");
const token_1 = require("../token/token");

@@ -14,7 +15,9 @@ const dom_token_list_1 = require("./dom-token-list");

super(astToken, ownElement.ownerMLDocument);
_MLAttr_potentialName.set(this, void 0);
_MLAttr_potentialValue.set(this, void 0);
this.endQuote = null;
this.equal = null;
_MLAttr_localName.set(this, void 0);
this.nameNode = null;
_MLAttr_namespaceURI.set(this, void 0);
_MLAttr_potentialName.set(this, void 0);
_MLAttr_potentialValue.set(this, void 0);
this.spacesAfterEqual = null;

@@ -53,2 +56,5 @@ this.spacesBeforeEqual = null;

}
const ns = (0, ml_spec_1.resolveNamespace)(tslib_1.__classPrivateFieldGet(this, _MLAttr_potentialName, "f"), ownElement.namespaceURI);
tslib_1.__classPrivateFieldSet(this, _MLAttr_localName, ns.localName, "f");
tslib_1.__classPrivateFieldSet(this, _MLAttr_namespaceURI, ns.namespaceURI, "f");
this.ownerElement = ownElement;

@@ -65,3 +71,3 @@ this.isDuplicatable = this._astToken.isDuplicatable;

get localName() {
throw new unexpected_call_error_1.default('Not supported "localname" property');
return tslib_1.__classPrivateFieldGet(this, _MLAttr_localName, "f");
}

@@ -84,3 +90,3 @@ /**

get namespaceURI() {
throw new unexpected_call_error_1.default('Not supported "namespaceURI" property');
return tslib_1.__classPrivateFieldGet(this, _MLAttr_namespaceURI, "f");
}

@@ -128,2 +134,8 @@ /**

/**
* @implements `@markuplint/ml-core` API: `MLAttr`
*/
get tokenList() {
return this.isDynamicValue ? null : new dom_token_list_1.MLDomTokenList(this.value, [this]);
}
/**
* @implements DOM API: `Attr`

@@ -138,8 +150,2 @@ * @see https://dom.spec.whatwg.org/#dom-attr-value

*/
get tokenList() {
return this.isDynamicValue ? null : new dom_token_list_1.MLDomTokenList(this.value, [this]);
}
/**
* @implements `@markuplint/ml-core` API: `MLAttr`
*/
toNormalizeString() {

@@ -157,2 +163,2 @@ if (this.nameNode && this.equal && this.startQuote && this.valueNode && this.endQuote) {

exports.MLAttr = MLAttr;
_MLAttr_potentialName = new WeakMap(), _MLAttr_potentialValue = new WeakMap();
_MLAttr_localName = new WeakMap(), _MLAttr_namespaceURI = new WeakMap(), _MLAttr_potentialName = new WeakMap(), _MLAttr_potentialValue = new WeakMap();

@@ -9,2 +9,3 @@ import type { MLDocument } from './document';

readonly isTransparent: boolean;
constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
/**

@@ -22,3 +23,2 @@ * Returns a string appropriate for the type of node as `MLBlock`

get nodeType(): MarkuplintPreprocessorBlockType;
constructor(astNode: MLASTPreprocessorSpecificBlock, document: MLDocument<T, O>);
/**

@@ -25,0 +25,0 @@ * @implements DOM API: `ChildNode`

import type { MLElement } from './element';
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
import type { RuleConfigValue } from '@markuplint/ml-config';
import { MLNode } from './node';
export declare abstract class MLCharacterData<T extends RuleConfigValue, O = null, A extends MLASTAbstructNode = MLASTAbstructNode> extends MLNode<T, O, A> implements CharacterData {
export declare abstract class MLCharacterData<T extends RuleConfigValue, O = null, A extends MLASTAbstractNode = MLASTAbstractNode> extends MLNode<T, O, A> implements CharacterData {
/**

@@ -7,0 +7,0 @@ * @implements DOM API: `CharacterData`

@@ -8,3 +8,3 @@ import type { MLBlock } from './block';

import type { RuleConfigValue } from '@markuplint/ml-config';
export declare type MLChildNode<T extends RuleConfigValue, O = null> = MLDocumentType<T, O> | MLCharacterData<T, O> | MLText<T, O> | MLElement<T, O> | MLBlock<T, O>;
export type MLChildNode<T extends RuleConfigValue, O = null> = MLDocumentType<T, O> | MLCharacterData<T, O> | MLText<T, O> | MLElement<T, O> | MLBlock<T, O>;
export declare function isChildNode<T extends RuleConfigValue, O = null>(node: MLNode<T, O>): node is MLChildNode<T, O>;
import type { DocumentFragmentNodeType } from './types';
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
import type { RuleConfigValue } from '@markuplint/ml-config';
import { MLParentNode } from './parent-node';
export declare class MLDocumentFragment<T extends RuleConfigValue, O = null> extends MLParentNode<T, O, MLASTAbstructNode> implements DocumentFragment {
export declare class MLDocumentFragment<T extends RuleConfigValue, O = null> extends MLParentNode<T, O, MLASTAbstractNode> implements DocumentFragment {
/**

@@ -7,0 +7,0 @@ * Returns a string appropriate for the type of node as `DocumentFragment`

@@ -11,2 +11,3 @@ import type { MLDocument } from './document';

readonly systemId: string;
constructor(astNode: MLASTDoctype, document: MLDocument<T, O>);
/**

@@ -22,3 +23,2 @@ * Returns a string appropriate for the type of node as `DocumentType`

get nodeType(): DocumentTypeNodeType;
constructor(astNode: MLASTDoctype, document: MLDocument<T, O>);
/**

@@ -25,0 +25,0 @@ * @implements DOM API: `CharacterData`

@@ -12,4 +12,4 @@ import type { MLRule } from '../../ml-rule';

import type { DocumentNodeType } from './types';
import type { MLASTDocument } from '@markuplint/ml-ast';
import type { RuleConfigValue } from '@markuplint/ml-config';
import type { EndTagType, MLASTDocument } from '@markuplint/ml-ast';
import type { Pretender, RuleConfigValue } from '@markuplint/ml-config';
import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';

@@ -20,9 +20,24 @@ import { MLParentNode } from './parent-node';

/**
* 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`.
*
* @default false
*/
readonly booleanish: boolean;
/**
*
*/
currentRule: MLRule<T, O> | null;
/**
* This is defined by the parser.
*
* @default "omittable"
*/
readonly endTag: 'xml' | 'omittable' | 'never';
readonly endTag: EndTagType;
/**

@@ -45,2 +60,13 @@ *

/**
*
* @param ast node list of markuplint AST
* @param ruleset ruleset object
*/
constructor(ast: MLASTDocument, ruleset: Ruleset, schemas: readonly [MLMLSpec, ...ExtendedSpec[]], options?: {
filename?: string;
endTag?: 'xml' | 'omittable' | 'never';
booleanish?: boolean;
pretenders?: Pretender[];
});
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**

@@ -51,2 +77,9 @@ *

*/
get URL(): string;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Document`
*/
get activeElement(): Element | null;

@@ -56,2 +89,9 @@ /**

*
* @unsupported
* @implements DOM API: `Document`
*/
get adoptedStyleSheets(): CSSStyleSheet[];
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated

@@ -379,2 +419,10 @@ * @unsupported

*/
get onbeforeinput(): ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Document`
*/
get onblur(): ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;

@@ -388,2 +436,10 @@ /**

*/
get oncancel(): ((this: GlobalEventHandlers, ev: Event) => any) | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Document`
*/
get oncanplay(): ((this: GlobalEventHandlers, ev: Event) => any) | null;

@@ -1176,9 +1232,2 @@ /**

*/
get URL(): string;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Document`
*/
get visibilityState(): DocumentVisibilityState;

@@ -1194,11 +1243,2 @@ /**

/**
*
* @param ast node list of markuplint AST
* @param ruleset ruleset object
*/
constructor(ast: MLASTDocument, ruleset: Ruleset, schemas: readonly [MLMLSpec, ...ExtendedSpec[]], options?: {
filename?: string;
endTag?: 'xml' | 'omittable' | 'never';
});
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**

@@ -1309,3 +1349,3 @@ *

*/
createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator;
createNSResolver(nodeResolver: Node): XPathNSResolver;
/**

@@ -1317,3 +1357,3 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

*/
createNSResolver(nodeResolver: Node): XPathNSResolver;
createNodeIterator(root: Node, whatToShow?: number, filter?: NodeFilter | null): NodeIterator;
/**

@@ -1537,2 +1577,6 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

*/
searchNodeByLocation(line: number, col: number): MLNode<T, O, import("@markuplint/ml-ast").MLASTAbstractNode> | null;
/**
* @implements `@markuplint/ml-core` API: `MLDocument`
*/
setRule(rule: MLRule<T, O> | null): void;

@@ -1565,3 +1609,4 @@ /**

writeln(...text: string[]): void;
private _pretending;
private _ruleMapping;
}

@@ -33,10 +33,11 @@ "use strict";

*/
_MLDocument_filename.set(this, void 0);
_MLDocument_tokenList.set(this, null);
this.currentRule = null;
/**
*
*/
this.currentRule = null;
_MLDocument_filename.set(this, void 0);
_MLDocument_tokenList.set(this, null);
this.isFragment = ast.isFragment;
this.specs = (0, ml_spec_1.schemaToSpec)(schemas);
this.booleanish = (options === null || options === void 0 ? void 0 : options.booleanish) || false;
this.endTag = (_a = options === null || options === void 0 ? void 0 : options.endTag) !== null && _a !== void 0 ? _a : 'omittable';

@@ -53,2 +54,3 @@ tslib_1.__classPrivateFieldSet(this, _MLDocument_filename, options === null || options === void 0 ? void 0 : options.filename, "f");

.filter((n) => !!n));
this._pretending(options === null || options === void 0 ? void 0 : options.pretenders);
this._ruleMapping(ruleset);

@@ -62,2 +64,11 @@ }

*/
get URL() {
throw new unexpected_call_error_1.default('Not supported "URL" property');
}
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Document`
*/
get activeElement() {

@@ -69,2 +80,11 @@ throw new unexpected_call_error_1.default('Not supported "activeElement" property');

*
* @unsupported
* @implements DOM API: `Document`
*/
get adoptedStyleSheets() {
throw new unexpected_call_error_1.default('Not supported "adoptedStyleSheets" property');
}
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated

@@ -327,3 +347,3 @@ * @unsupported

get fullscreenEnabled() {
throw new unexpected_call_error_1.default('Not supported "UfullscreenEnabledRL" property');
throw new unexpected_call_error_1.default('Not supported "FullscreenEnabledURL" property');
}

@@ -494,2 +514,12 @@ /**

*/
get onbeforeinput() {
throw new unexpected_call_error_1.default('Not supported "onbeforeinput" property');
}
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Document`
*/
get onblur() {

@@ -505,2 +535,12 @@ throw new unexpected_call_error_1.default('Not supported "onblur" property');

*/
get oncancel() {
throw new unexpected_call_error_1.default('Not supported "oncanplay" property');
}
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Document`
*/
get oncanplay() {

@@ -1497,11 +1537,2 @@ throw new unexpected_call_error_1.default('Not supported "oncanplay" property');

*/
get URL() {
throw new unexpected_call_error_1.default('Not supported "URL" property');
}
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Document`
*/
get visibilityState() {

@@ -1654,4 +1685,4 @@ throw new unexpected_call_error_1.default('Not supported "visibilityState" property');

*/
createNodeIterator(root, whatToShow, filter) {
throw new unexpected_call_error_1.default('Not supported "createNodeIterator" method');
createNSResolver(nodeResolver) {
throw new unexpected_call_error_1.default('Not supported "createNSResolver" method');
}

@@ -1664,4 +1695,4 @@ /**

*/
createNSResolver(nodeResolver) {
throw new unexpected_call_error_1.default('Not supported "createNSResolver" method');
createNodeIterator(root, whatToShow, filter) {
throw new unexpected_call_error_1.default('Not supported "createNodeIterator" method');
}

@@ -1961,2 +1992,13 @@ /**

*/
searchNodeByLocation(line, col) {
for (const node of this.nodeList) {
if (node.startLine <= line && line <= node.endLine && node.startCol <= col && col <= node.endCol) {
return node;
}
}
return null;
}
/**
* @implements `@markuplint/ml-core` API: `MLDocument`
*/
setRule(rule) {

@@ -2015,2 +2057,15 @@ this.currentRule = rule;

}
_pretending(pretenders) {
if (docLog.enabled) {
docLog('Pretending: %O', pretenders);
}
if (!pretenders) {
return;
}
for (const node of this.nodeList) {
if (node.is(node.ELEMENT_NODE)) {
node.pretending(pretenders);
}
}
}
_ruleMapping(ruleset) {

@@ -2017,0 +2072,0 @@ if (docLog.enabled) {

import type { MLAttr } from './attr';
import type { RuleInfo } from '@markuplint/ml-config';
declare type Scope = {
type Scope = {
raw: string;

@@ -12,4 +12,4 @@ startOffset: number;

#private;
constructor(tokens: string, ownerAttrs: MLAttr<any, any>[]);
get value(): string;
constructor(tokens: string, ownerAttrs: MLAttr<any, any>[]);
add(...tokens: string[]): void;

@@ -30,6 +30,6 @@ /**

supports(token: string): boolean;
toString(): string;
toggle(token: string, force?: boolean): boolean;
toString(): string;
private _pick;
}
export {};
"use strict";
var _MLDomTokenList_set, _MLDomTokenList_origin, _MLDomTokenList_ownerAttrs;
var _MLDomTokenList_origin, _MLDomTokenList_ownerAttrs, _MLDomTokenList_set;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -15,3 +15,2 @@ exports.MLDomTokenList = void 0;

super(...list);
_MLDomTokenList_set.set(this, void 0);
_MLDomTokenList_origin.set(this, void 0);

@@ -23,2 +22,3 @@ /**

_MLDomTokenList_ownerAttrs.set(this, void 0);
_MLDomTokenList_set.set(this, void 0);
tslib_1.__classPrivateFieldSet(this, _MLDomTokenList_origin, tokens, "f");

@@ -104,8 +104,8 @@ tslib_1.__classPrivateFieldSet(this, _MLDomTokenList_ownerAttrs, ownerAttrs, "f");

}
toString() {
return this.value;
}
toggle(token, force) {
throw new unexpected_call_error_1.default('Not supported "toggle" method');
}
toString() {
return this.value;
}
_pick(token, _offset = 0) {

@@ -140,2 +140,2 @@ var _a, _b, _c, _d, _e, _f;

exports.MLDomTokenList = MLDomTokenList;
_MLDomTokenList_set = new WeakMap(), _MLDomTokenList_origin = new WeakMap(), _MLDomTokenList_ownerAttrs = new WeakMap();
_MLDomTokenList_origin = new WeakMap(), _MLDomTokenList_ownerAttrs = new WeakMap(), _MLDomTokenList_set = new WeakMap();
import type { MLDocument } from './document';
import type { MLNamedNodeMap } from './named-node-map';
import type { MLText } from './text';
import type { ElementNodeType } from './types';
import type { MLASTElement, NamespaceURI } from '@markuplint/ml-ast';
import type { RuleConfigValue } from '@markuplint/ml-config';
import type { ElementNodeType, PretenderContext } from './types';
import type { ElementType, MLASTElement, NamespaceURI } from '@markuplint/ml-ast';
import type { Pretender, RuleConfigValue, RuleInfo } from '@markuplint/ml-config';
import type { ARIAVersion } from '@markuplint/ml-spec';
import { MLToken } from '../token/token';

@@ -14,5 +15,5 @@ import { MLAttr } from './attr';

readonly closeTag: MLToken | null;
readonly elementType: ElementType;
readonly endSpace: MLToken | null;
readonly hasSpreadAttr: boolean;
readonly isCustomElement: boolean;
readonly isForeignElement: boolean;

@@ -25,3 +26,5 @@ readonly isOmitted: boolean;

readonly ontouchstart?: ((this: GlobalEventHandlers, ev: TouchEvent) => any) | null | undefined;
pretenderContext: PretenderContext<MLElement<T, O>, T, O> | null;
readonly selfClosingSolidus: MLToken | null;
constructor(astNode: MLASTElement, document: MLDocument<T, O>);
/**

@@ -98,2 +101,10 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

*/
get ariaColIndexText(): string | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Element`
*/
get ariaColSpan(): string | null;

@@ -147,2 +158,10 @@ /**

*/
get ariaInvalid(): string | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Element`
*/
get ariaKeyShortcuts(): string | null;

@@ -276,2 +295,10 @@ /**

*/
get ariaRowIndexText(): string | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Element`
*/
get ariaRowSpan(): string | null;

@@ -465,4 +492,13 @@ /**

*
* @deprecated
* @unsupported
* @implements DOM API: `Element`
* @see https://html.spec.whatwg.org/multipage/interaction.html#dom-inert
*/
get inert(): boolean;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Element`
* @see https://w3c.github.io/DOM-Parsing/#dom-innerhtml-innerhtml

@@ -640,2 +676,10 @@ */

*/
get onbeforeinput(): ((this: GlobalEventHandlers, ev: InputEvent) => any) | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Element`
*/
get onblur(): ((this: GlobalEventHandlers, ev: FocusEvent) => any) | null;

@@ -649,2 +693,10 @@ /**

*/
get oncancel(): ((this: GlobalEventHandlers, ev: Event) => any) | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated
* @unsupported
* @implements DOM API: `Element`
*/
get oncanplay(): ((this: GlobalEventHandlers, ev: Event) => any) | null;

@@ -1357,2 +1409,14 @@ /**

* @implements DOM API: `Element`
* @see https://w3c.github.io/aria/#ARIAMixin
*/
get role(): string;
/**
* @implements `@markuplint/ml-core` API: `MLNode`
*/
get rule(): RuleInfo<T, O>;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Element`
* @see https://www.w3.org/TR/cssom-view-1/#ref-for-dom-element-scrollheight-1

@@ -1456,3 +1520,2 @@ */

get translate(): boolean;
constructor(astNode: MLASTElement, document: MLDocument<T, O>);
/**

@@ -1523,3 +1586,3 @@ * @implements DOM API: `Element`

*/
getAccessibleName(): string;
getAccessibleName(version: ARIAVersion): string;
/**

@@ -1539,3 +1602,11 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#dom-element-getattributenodens
*/
getAttributeNS(namespace: string | null, localName: string): string | null;
/**
* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-getattributenames%E2%91%A0

@@ -1558,9 +1629,5 @@ */

/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#dom-element-getattributenodens
* @implements `@markuplint/ml-core` API: `MLElement`
*/
getAttributeNS(namespace: string | null, localName: string): string | null;
getAttributePretended(attrName: string): string | null;
/**

@@ -1682,2 +1749,6 @@ * @implements `@markuplint/ml-core` API: `MLElement`

/**
* @implements `@markuplint/ml-core` API: `MLElement`
*/
isEmpty(): boolean;
/**
* @implements DOM API: `Element`

@@ -1688,2 +1759,6 @@ * @see https://dom.spec.whatwg.org/#ref-for-dom-element-matches%E2%91%A0

/**
* Pretenders Initialization
*/
pretending(pretenders: Pretender[]): void;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**

@@ -1713,5 +1788,5 @@ *

* @implements DOM API: `Element`
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-D589198
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-removeattributens%E2%91%A0
*/
removeAttributeNode(attr: Attr): Attr;
removeAttributeNS(namespace: string | null, localName: string): void;
/**

@@ -1722,5 +1797,5 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-removeattributens%E2%91%A0
* @see https://www.w3.org/TR/DOM-Level-2-Core/core.html#ID-D589198
*/
removeAttributeNS(namespace: string | null, localName: string): void;
removeAttributeNode(attr: Attr): Attr;
/**

@@ -1791,5 +1866,5 @@ * @implements DOM API: `Element`

* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#dom-element-setattributenode
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-setattributens%E2%91%A0
*/
setAttributeNode(attr: Attr): Attr | null;
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
/**

@@ -1800,5 +1875,5 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#dom-element-setattributenodens
* @see https://dom.spec.whatwg.org/#dom-element-setattributenode
*/
setAttributeNodeNS(attr: Attr): Attr | null;
setAttributeNode(attr: Attr): Attr | null;
/**

@@ -1809,5 +1884,5 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-setattributens%E2%91%A0
* @see https://dom.spec.whatwg.org/#dom-element-setattributenodens
*/
setAttributeNS(namespace: string | null, qualifiedName: string, value: string): void;
setAttributeNodeNS(attr: Attr): Attr | null;
/**

@@ -1822,10 +1897,2 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-toggleattribute%E2%91%A0
*/
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
/**
* @implements `@markuplint/ml-core` API: `MLElement`

@@ -1841,2 +1908,10 @@ */

*
* @unsupported
* @implements DOM API: `Element`
* @see https://dom.spec.whatwg.org/#ref-for-dom-element-toggleattribute%E2%91%A0
*/
toggleAttribute(qualifiedName: string, force?: boolean): boolean;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @deprecated

@@ -1843,0 +1918,0 @@ * @unsupported

import type { MLChildNode } from './child-node';
import type { MLElement } from './element';
import type { RuleConfigValue } from '@markuplint/ml-config';
export declare function toNodeList<T extends RuleConfigValue, O extends Object | null, N extends MLChildNode<T, O>>(nodes: ReadonlyArray<N>): NodeListOf<N>;
export declare function toNodeList<T extends RuleConfigValue, O, N extends MLChildNode<T, O>>(nodes: ReadonlyArray<N>): NodeListOf<N>;
export declare function toHTMLCollection<T extends RuleConfigValue, O = null>(nodes: ReadonlyArray<MLElement<T, O>>): HTMLCollectionOf<MLElement<T, O>>;
export declare function nodeListToHTMLCollection<T extends RuleConfigValue, O = null>(nodeList: NodeListOf<MLChildNode<T, O>>): HTMLCollectionOf<MLElement<T, O>>;
import type { MLNode } from './node';
import type { MappedNode } from './types';
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
import type { RuleConfigValue } from '@markuplint/ml-config';
declare class NodeStore {
#private;
getNode<N extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(astNode: N): MappedNode<N, T, O>;
setNode<A extends MLASTAbstructNode, T extends RuleConfigValue, O = null>(astNode: A, node: MLNode<T, O, A>): void;
getNode<N extends MLASTAbstractNode, T extends RuleConfigValue, O = null>(astNode: N): MappedNode<N, T, O>;
setNode<A extends MLASTAbstractNode, T extends RuleConfigValue, O = null>(astNode: A, node: MLNode<T, O, A>): void;
}

@@ -10,0 +10,0 @@ /**

@@ -8,6 +8,6 @@ import type { RuleInfo } from '../..';

import type { MarkuplintPreprocessorBlockType, NodeType, NodeTypeOf } from './types';
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
import type { AnyRule, RuleConfigValue } from '@markuplint/ml-config';
import { MLToken } from '../token/token';
export declare abstract class MLNode<T extends RuleConfigValue, O = null, A extends MLASTAbstructNode = MLASTAbstructNode> extends MLToken<A> implements Node {
export declare abstract class MLNode<T extends RuleConfigValue, O = null, A extends MLASTAbstractNode = MLASTAbstractNode> extends MLToken<A> implements Node {
#private;

@@ -106,3 +106,2 @@ /**

readonly PROCESSING_INSTRUCTION_NODE = 7;
readonly rules: Record<string, AnyRule>;
/**

@@ -113,3 +112,8 @@ * @implements DOM API: `Node`

readonly TEXT_NODE = 3;
/**
*
*/
readonly rules: Record<string, AnyRule>;
protected _astToken: A;
constructor(astNode: A, document: MLDocument<T, O>);
/**

@@ -257,2 +261,10 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

/**
* @implements `@markuplint/ml-core` API: `MLNode`
*/
get prevNode(): MLNode<T, O> | null;
/**
* @implements `@markuplint/ml-core` API: `MLNode`
*/
get prevToken(): MLNode<T, O> | null;
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**

@@ -268,13 +280,5 @@ *

*/
get prevNode(): MLNode<T, O> | null;
/**
* @implements `@markuplint/ml-core` API: `MLNode`
*/
get prevToken(): MLNode<T, O> | null;
/**
* @implements `@markuplint/ml-core` API: `MLNode`
*/
get rule(): RuleInfo<T, O>;
/**
* Returns a syntaxical parent node
* Returns a syntactical parent node
*

@@ -316,3 +320,3 @@ * ## HTML:

*/
get syntaxicalParentNode(): MLDocument<any, any> | MLDocumentFragment<any, any> | MLElement<T, O> | MLBlock<T, O> | null;
get syntacticalParentNode(): MLDocument<any, any> | MLDocumentFragment<any, any> | MLElement<T, O> | MLBlock<T, O> | null;
/**

@@ -328,3 +332,2 @@ * Return the text content.

get textContent(): string | null;
constructor(astNode: A, document: MLDocument<T, O>);
/**

@@ -482,2 +485,6 @@ * **IT THROWS AN ERROR WHEN CALLING THIS.**

replaceChild<T extends Node>(node: Node, child: T): T;
/**
* @implements `@markuplint/ml-core` API: `MLNode`
*/
resetChildren(childNodes?: NodeListOf<MLChildNode<T, O>>): void;
}

@@ -15,18 +15,3 @@ "use strict";

/**
* Cached `childNodes` property
*/
_MLNode_childNodes.set(this, void 0);
/**
* Owner `Document`
*
* @implements DOM API: `Node`
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-ownerdocument
*/
_MLNode_ownerDocument.set(this, void 0);
/**
* Cached `prevToken` property
*/
_MLNode_prevToken.set(this, void 0);
/**
* @implements DOM API: `Node`
* @see https://dom.spec.whatwg.org/#interface-node

@@ -122,3 +107,2 @@ */

this.PROCESSING_INSTRUCTION_NODE = 7;
this.rules = {};
/**

@@ -129,2 +113,21 @@ * @implements DOM API: `Node`

this.TEXT_NODE = 3;
/**
* Cached `childNodes` property
*/
_MLNode_childNodes.set(this, void 0);
/**
* Owner `Document`
*
* @implements DOM API: `Node`
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-ownerdocument
*/
_MLNode_ownerDocument.set(this, void 0);
/**
* Cached `prevToken` property
*/
_MLNode_prevToken.set(this, void 0);
/**
*
*/
this.rules = {};
this._astToken = astNode;

@@ -339,3 +342,3 @@ tslib_1.__classPrivateFieldSet(this, _MLNode_ownerDocument, document, "f");

get parentNode() {
const parentNode = this.syntaxicalParentNode;
const parentNode = this.syntacticalParentNode;
if (!parentNode) {

@@ -359,12 +362,2 @@ return null;

/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Node`
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
*/
get previousSibling() {
throw new unexpected_call_error_1.default('Not supported "previousSibling" property');
}
/**
* @implements `@markuplint/ml-core` API: `MLNode`

@@ -407,2 +400,12 @@ */

/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**
*
* @unsupported
* @implements DOM API: `Node`
* @see https://dom.spec.whatwg.org/#ref-for-dom-node-previoussibling%E2%91%A0
*/
get previousSibling() {
throw new unexpected_call_error_1.default('Not supported "previousSibling" property');
}
/**
* @implements `@markuplint/ml-core` API: `MLNode`

@@ -419,3 +422,3 @@ */

/**
* Returns a syntaxical parent node
* Returns a syntactical parent node
*

@@ -457,3 +460,3 @@ * ## HTML:

*/
get syntaxicalParentNode() {
get syntacticalParentNode() {
if (!this._astToken.parentNode) {

@@ -672,4 +675,10 @@ return this.ownerMLDocument;

}
/**
* @implements `@markuplint/ml-core` API: `MLNode`
*/
resetChildren(childNodes) {
tslib_1.__classPrivateFieldSet(this, _MLNode_childNodes, childNodes !== null && childNodes !== void 0 ? childNodes : tslib_1.__classPrivateFieldGet(this, _MLNode_childNodes, "f"), "f");
}
}
exports.MLNode = MLNode;
_MLNode_childNodes = new WeakMap(), _MLNode_ownerDocument = new WeakMap(), _MLNode_prevToken = new WeakMap();
import type { MLElement } from './element';
import type { MLASTAbstructNode } from '@markuplint/ml-ast';
import type { MLASTAbstractNode } from '@markuplint/ml-ast';
import type { RuleConfigValue } from '@markuplint/ml-config';

@@ -9,3 +9,3 @@ import { MLNode } from './node';

*/
export declare abstract class MLParentNode<T extends RuleConfigValue, O = null, A extends MLASTAbstructNode = MLASTAbstructNode> extends MLNode<T, O, A> implements ParentNode {
export declare abstract class MLParentNode<T extends RuleConfigValue, O = null, A extends MLASTAbstractNode = MLASTAbstractNode> extends MLNode<T, O, A> implements ParentNode {
#private;

@@ -12,0 +12,0 @@ /**

@@ -5,4 +5,4 @@ import type { MLDocument } from './document';

import type { Specificity } from '@markuplint/selector';
declare type RuleType = 'rules' | 'nodeRules' | 'childNodeRules';
declare type MappingLayer = {
type RuleType = 'rules' | 'nodeRules' | 'childNodeRules';
type MappingLayer = {
from: RuleType;

@@ -9,0 +9,0 @@ specificity: Specificity;

@@ -11,16 +11,26 @@ import type { MLToken } from '../token/token';

import type { MLText } from './text';
import type { MLASTAbstructNode, MLASTAttr, MLASTComment, MLASTDoctype, MLASTElement, MLASTParentNode, MLASTPreprocessorSpecificBlock, MLASTText, MLToken as MLASTToken } from '@markuplint/ml-ast/';
import type { RuleConfigValue } from '@markuplint/ml-config';
export declare type MappedNode<N, T extends RuleConfigValue, O = null> = N extends MLASTElement ? MLElement<T, O> : N extends MLASTParentNode ? MLElement<T, O> : N extends MLASTComment ? MLComment<T, O> : N extends MLASTText ? MLText<T, O> : N extends MLASTDoctype ? MLDocumentType<T, O> : N extends MLASTPreprocessorSpecificBlock ? MLBlock<T, O> : N extends MLASTAbstructNode ? MLNode<T, O, MLASTAbstructNode> : N extends MLASTAttr ? MLAttr<T, O> : N extends MLASTToken ? MLToken : never;
export declare type NodeTypeOf<NT extends NodeType, T extends RuleConfigValue, O = null> = NT extends ElementNodeType ? MLElement<T, O> : NT extends CommentNodeType ? MLComment<T, O> : NT extends TextNodeType ? MLText<T, O> : NT extends DocumentNodeType ? MLDocument<T, O> : NT extends DocumentTypeNodeType ? MLDocumentType<T, O> : NT extends DocumentFragmentNodeType ? MLDocumentFragment<T, O> : NT extends MarkuplintPreprocessorBlockType ? MLBlock<T, O> : NT extends AttributeNodeType ? MLAttr<T, O> : never;
export declare type ElementNodeType = 1;
export declare type AttributeNodeType = 2;
export declare type TextNodeType = 3;
export declare type CDATASectionNodeType = 4;
export declare type ProcessingInstructionNodeType = 7;
export declare type CommentNodeType = 8;
export declare type DocumentNodeType = 9;
export declare type DocumentTypeNodeType = 10;
export declare type DocumentFragmentNodeType = 11;
export declare type MarkuplintPreprocessorBlockType = 101;
export declare type NodeType = ElementNodeType | AttributeNodeType | TextNodeType | CDATASectionNodeType | ProcessingInstructionNodeType | CommentNodeType | DocumentNodeType | DocumentTypeNodeType | DocumentFragmentNodeType | MarkuplintPreprocessorBlockType;
import type { MLASTAbstractNode, MLASTAttr, MLASTComment, MLASTDoctype, MLASTElement, MLASTParentNode, MLASTPreprocessorSpecificBlock, MLASTText, MLToken as MLASTToken } from '@markuplint/ml-ast/';
import type { PretenderARIA, RuleConfigValue } from '@markuplint/ml-config';
export type MappedNode<N, T extends RuleConfigValue, O = null> = N extends MLASTElement ? MLElement<T, O> : N extends MLASTParentNode ? MLElement<T, O> : N extends MLASTComment ? MLComment<T, O> : N extends MLASTText ? MLText<T, O> : N extends MLASTDoctype ? MLDocumentType<T, O> : N extends MLASTPreprocessorSpecificBlock ? MLBlock<T, O> : N extends MLASTAbstractNode ? MLNode<T, O, MLASTAbstractNode> : N extends MLASTAttr ? MLAttr<T, O> : N extends MLASTToken ? MLToken : never;
export type NodeTypeOf<NT extends NodeType, T extends RuleConfigValue, O = null> = NT extends ElementNodeType ? MLElement<T, O> : NT extends CommentNodeType ? MLComment<T, O> : NT extends TextNodeType ? MLText<T, O> : NT extends DocumentNodeType ? MLDocument<T, O> : NT extends DocumentTypeNodeType ? MLDocumentType<T, O> : NT extends DocumentFragmentNodeType ? MLDocumentFragment<T, O> : NT extends MarkuplintPreprocessorBlockType ? MLBlock<T, O> : NT extends AttributeNodeType ? MLAttr<T, O> : never;
export type ElementNodeType = 1;
export type AttributeNodeType = 2;
export type TextNodeType = 3;
export type CDATASectionNodeType = 4;
export type ProcessingInstructionNodeType = 7;
export type CommentNodeType = 8;
export type DocumentNodeType = 9;
export type DocumentTypeNodeType = 10;
export type DocumentFragmentNodeType = 11;
export type MarkuplintPreprocessorBlockType = 101;
export type NodeType = ElementNodeType | AttributeNodeType | TextNodeType | CDATASectionNodeType | ProcessingInstructionNodeType | CommentNodeType | DocumentNodeType | DocumentTypeNodeType | DocumentFragmentNodeType | MarkuplintPreprocessorBlockType;
export type PretenderContext<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> = PretenderContextPretender<N, T, O> | PretenderContextPretended<N, T, O>;
export type PretenderContextPretender<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> = {
readonly type: 'pretender';
readonly as: N;
readonly aria?: PretenderARIA;
};
export type PretenderContextPretended<N extends MLElement<T, O>, T extends RuleConfigValue, O = null> = {
readonly type: 'origin';
readonly origin: N;
};

@@ -6,2 +6,3 @@ import type { MLToken as MLASTToken } from '@markuplint/ml-ast';

protected readonly _astToken: A;
constructor(astToken: A);
/**

@@ -39,3 +40,2 @@ * @implements `@markuplint/ml-core` API: `MLDOMToken`

get startOffset(): number;
constructor(astToken: A);
/**

@@ -42,0 +42,0 @@ * @implements `@markuplint/ml-core` API: `MLDOMToken`

@@ -10,2 +10,3 @@ import type { MLDocument } from '../ml-dom/node/document';

readonly translate: Translator;
constructor(document: MLDocument<T, O>, locale: LocaleSet);
get reports(): ({

@@ -26,3 +27,2 @@ message: string;

})[];
constructor(document: MLDocument<T, O>, locale: LocaleSet);
provide(): {

@@ -54,2 +54,3 @@ document: MLDocument<T, O>;

report(report: CheckerReport<T, O>): boolean;
private _push;
}

@@ -33,3 +33,3 @@ "use strict";

if (r) {
tslib_1.__classPrivateFieldGet(this, _MLRuleContext_reports, "f").push(r);
this._push(r);
return true;

@@ -39,4 +39,9 @@ }

}
tslib_1.__classPrivateFieldGet(this, _MLRuleContext_reports, "f").push(report);
this._push(report);
}
_push(report) {
if (!tslib_1.__classPrivateFieldGet(this, _MLRuleContext_reports, "f").find(r => is(r, report))) {
tslib_1.__classPrivateFieldGet(this, _MLRuleContext_reports, "f").push(report);
}
}
}

@@ -53,1 +58,13 @@ exports.MLRuleContext = MLRuleContext;

}
function is(r1, r2) {
if ('col' in r1 && 'col' in r2) {
return r1.col === r2.col && r1.line === r2.line && r1.message === r2.message && r1.raw === r2.raw;
}
if ('scope' in r1) {
if (!('scope' in r2)) {
return false;
}
return r1.scope === r2.scope && r1.message === r2.message;
}
return false;
}

@@ -9,5 +9,8 @@ import type { Ruleset } from '..';

readonly defaultOptions: O;
readonly defaultServerity: Severity;
readonly defaultSeverity: Severity;
readonly defaultValue: T;
readonly name: string;
constructor(o: RuleSeed<T, O> & {
name: string;
});
/**

@@ -23,5 +26,2 @@ * The following getter is unused internally,

protected get v(): RuleSeed<T, O>['verify'];
constructor(o: RuleSeed<T, O> & {
name: string;
});
getRuleInfo(ruleSet: Ruleset, ruleName: string): GlobalRuleInfo<T, O>;

@@ -32,2 +32,2 @@ optimizeOption(configSettings: T | RuleConfig<T, O> | undefined): RuleInfo<T, O>;

}
export declare type AnyMLRule = MLRule<RuleConfigValue, unknown>;
export type AnyMLRule = MLRule<RuleConfigValue, unknown>;

@@ -13,3 +13,3 @@ "use strict";

this.name = o.name;
this.defaultServerity = o.defaultServerity || 'error';
this.defaultSeverity = o.defaultSeverity || 'error';
this.defaultValue = (_a = o.defaultValue) !== null && _a !== void 0 ? _a : true;

@@ -46,3 +46,3 @@ this.defaultOptions = (_b = o.defaultOptions) !== null && _b !== void 0 ? _b : null;

disabled: !configSettings,
severity: this.defaultServerity,
severity: this.defaultSeverity,
value: this.defaultValue,

@@ -56,3 +56,3 @@ option: this.defaultOptions,

disabled: false,
severity: configSettings.severity || this.defaultServerity,
severity: configSettings.severity || this.defaultSeverity,
value: configSettings.value !== undefined ? configSettings.value : this.defaultValue,

@@ -76,3 +76,3 @@ option: Array.isArray(this.defaultOptions)

disabled: false,
severity: this.defaultServerity,
severity: this.defaultSeverity,
// @ts-ignore TODO: Wait for fix to bug of type guards in TypeScript

@@ -79,0 +79,0 @@ value: configSettings == null ? this.defaultValue : configSettings,

@@ -5,4 +5,4 @@ import type { Attr, Element } from '../ml-dom';

import type { Report, RuleConfigValue, Severity } from '@markuplint/ml-config';
export declare type RuleSeed<T extends RuleConfigValue = boolean, O = null> = {
defaultServerity?: Severity;
export type RuleSeed<T extends RuleConfigValue = boolean, O = null> = {
defaultSeverity?: Severity;
defaultValue?: T;

@@ -13,10 +13,10 @@ defaultOptions?: O;

};
export declare type Checker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P) => CheckerReport<T, O>;
export declare type ElementChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
export type Checker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P) => CheckerReport<T, O>;
export type ElementChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
el: Element<T, O>;
}) => CheckerReport<T, O>;
export declare type AttrChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
export type AttrChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
attr: Attr<T, O>;
}) => CheckerReport<T, O>;
export declare type CheckerReport<T extends RuleConfigValue, O = null> = (t: Translator) => Report<T, O> | undefined | null;
export declare type AnyRuleSeed = RuleSeed<any, any>;
export type CheckerReport<T extends RuleConfigValue, O = null> = (t: Translator) => Report<T, O> | undefined | null;
export type AnyRuleSeed = RuleSeed<any, any>;
import type { AnyRuleSeed } from '../ml-rule';
import type { Config } from '@markuplint/ml-config';
export declare type Plugin = {
export type Plugin = {
name: string;

@@ -8,6 +8,6 @@ rules?: Record<string, AnyRuleSeed>;

};
export declare type PluginCreator<S extends CreatePluginSettings> = {
export type PluginCreator<S extends CreatePluginSettings> = {
name: string;
create(setting: S): Omit<Plugin, 'name'>;
};
export declare type CreatePluginSettings = Record<string, unknown>;
export type CreatePluginSettings = Record<string, unknown>;

@@ -5,8 +5,9 @@ import type { MLMarkupLanguageParser } from '@markuplint/ml-ast';

import { Document } from '../ml-dom';
export declare type CreateTestOptions = {
export type CreateTestOptions = {
config?: Config;
parser?: MLMarkupLanguageParser;
specs?: MLMLSpec;
};
export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(sourceCode: string, options?: CreateTestOptions): Document<T, O>;
export declare function createTestNodeList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom/node/node").MLNode<any, any, import("@markuplint/ml-ast").MLASTAbstructNode>[];
export declare function createTestNodeList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom/node/node").MLNode<any, any, import("@markuplint/ml-ast").MLASTAbstractNode>[];
export declare function createTestTokenList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom/token/token").MLToken<import("@markuplint/ml-ast").MLToken>[];

@@ -13,0 +14,0 @@ export declare function createTestElement(sourceCode: string, options?: CreateTestOptions): import("../ml-dom").Element<any, any>;

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.dummySchemas = exports.createTestElement = exports.createTestTokenList = exports.createTestNodeList = exports.createTestDocument = void 0;
const tslib_1 = require("tslib");
const html_parser_1 = require("@markuplint/html-parser");
const html_spec_1 = tslib_1.__importDefault(require("@markuplint/html-spec"));
const convert_ruleset_1 = require("../convert-ruleset");
const ml_dom_1 = require("../ml-dom");
function createTestDocument(sourceCode, options) {
var _a;
const ast = (options === null || options === void 0 ? void 0 : options.parser) ? options.parser.parse(sourceCode) : (0, html_parser_1.parse)(sourceCode);
const ruleset = (0, convert_ruleset_1.convertRuleset)(options === null || options === void 0 ? void 0 : options.config);
const document = new ml_dom_1.Document(ast, ruleset, [{}, {}]);
const document = new ml_dom_1.Document(ast, ruleset, [(_a = options === null || options === void 0 ? void 0 : options.specs) !== null && _a !== void 0 ? _a : {}, {}]);
return document;

@@ -37,5 +40,4 @@ }

function dummySchemas() {
// @ts-ignore
return [{}, {}];
return [html_spec_1.default];
}
exports.dummySchemas = dummySchemas;
import type { AnyMLRule } from './ml-rule';
import type Ruleset from './ruleset';
import type { LocaleSet } from '@markuplint/i18n';
import type { MLMarkupLanguageParser } from '@markuplint/ml-ast';
import type { ParserOptions } from '@markuplint/ml-config';
import type { MLMarkupLanguageParser, ParserOptions } from '@markuplint/ml-ast';
import type { Pretender } from '@markuplint/ml-config';
import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
export declare type MLSchema = Readonly<[MLMLSpec, ...ExtendedSpec[]]>;
export declare type MLFabric = {
export type MLSchema = Readonly<[MLMLSpec, ...ExtendedSpec[]]>;
export type MLFabric = {
parser: MLMarkupLanguageParser;

@@ -15,2 +15,3 @@ ruleset: Partial<Ruleset>;

parserOptions: ParserOptions;
pretenders: Pretender[];
};
{
"name": "@markuplint/ml-core",
"version": "3.0.0-alpha.66+6cde1134",
"version": "3.0.0-canary.5+382d1365",
"description": "The core module of markuplint",

@@ -20,18 +20,18 @@ "repository": "git@github.com:markuplint/markuplint.git",

"dependencies": {
"@markuplint/config-presets": "3.0.0-alpha",
"@markuplint/i18n": "2.1.1",
"@markuplint/ml-ast": "2.0.1-dev.20220307.0",
"@markuplint/ml-config": "3.0.0-alpha.66+6cde1134",
"@markuplint/ml-spec": "3.0.0-alpha.82+6cde1134",
"@markuplint/parser-utils": "2.2.0",
"@markuplint/selector": "3.0.0-alpha.2105+6cde1134",
"@markuplint/config-presets": "3.0.0-canary.2421+382d1365",
"@markuplint/i18n": "3.0.0-canary.25+382d1365",
"@markuplint/ml-ast": "3.0.0-canary.69+382d1365",
"@markuplint/ml-config": "3.0.0-canary.34+382d1365",
"@markuplint/ml-spec": "3.0.0-canary.5+382d1365",
"@markuplint/parser-utils": "3.0.0-canary.5+382d1365",
"@markuplint/selector": "3.0.0-canary.2421+382d1365",
"debug": "^4.3.4",
"postcss-selector-parser": "^6.0.10",
"tslib": "^2.3.1"
"tslib": "^2.4.0"
},
"devDependencies": {
"@markuplint/html-parser": "2.2.1",
"@markuplint/html-parser": "3.0.0-canary.5+382d1365",
"@types/debug": "^4.1.7"
},
"gitHead": "6cde113402758a8fdbd6a0fcf98e78efd2cdb778"
"gitHead": "382d13653071bd02210d5430403d1a87c840398c"
}
# @markuplint/ml-core
[![npm version](https://badge.fury.io/js/%40markuplint%2Fml-core.svg)](https://www.npmjs.com/package/@markuplint/ml-core)
[![Build Status](https://travis-ci.org/markuplint/markuplint.svg?branch=main)](https://travis-ci.org/markuplint/markuplint)
[![Coverage Status](https://coveralls.io/repos/github/markuplint/markuplint/badge.svg?branch=main)](https://coveralls.io/github/markuplint/markuplint?branch=main)
## Documentation
- [API Document](https://markuplint.dev/api-docs)
## Install
[`markuplint`](https://www.npmjs.com/package/markuplint) package includes this package.
<details>
<summary>If you are installing purposely, how below:</summary>
```sh

@@ -14,1 +21,3 @@ $ npm install @markuplint/ml-core

```
</details>

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

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