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

@markuplint/ml-core

Package Overview
Dependencies
Maintainers
1
Versions
201
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 4.0.0-alpha.3 to 4.0.0-dev.28

lib/ml-dom/helper/get-indent.d.ts

4

lib/configs.browser.js
export async function getPreset(name) {
const res = await fetch(`@markuplint/config-presets/preset.${name}.json`).catch(() => new Error());
const res = await fetch(`@markuplint/config-presets/preset.${name}.json`).catch(() =>
// eslint-disable-next-line unicorn/error-message
new Error());
if (res instanceof Error) {

@@ -4,0 +6,0 @@ throw new ReferenceError(`Preset markuplint:${name} is not found`);

@@ -21,3 +21,3 @@ import { readFile } from 'node:fs/promises';

}
const searchPath = /Module\s"([^"]+)"\sneeds/i.exec(error.message);
const searchPath = /module\s"([^"]+)"\sneeds/i.exec(error.message);
const absPath = searchPath?.[1] ?? null;

@@ -30,11 +30,10 @@ log('Extract path: %s', absPath);

.replace(/^file:\/\//, '')
.replace(/\//g, path.sep)
.replaceAll('/', path.sep)
// Windows
.replace(/^[\\/][a-z]:/i, '');
.replace(/^[/\\][a-z]:/i, '');
log('Find JSON file path: %s', normalizePath);
const fileContent = await readFile(normalizePath, { encoding: 'utf8' });
log('Success to read JSON file path: %s', normalizePath);
return JSON.parse(fileContent);
}
return error.default ? error.default : error;
return error.default ?? error;
}

@@ -5,3 +5,3 @@ export { RuleInfo, RuleConfig, RuleConfigValue } from '@markuplint/ml-config';

export { enableDebug } from './debug.js';
export { getIndent } from './ml-dom/helper/getIndent.js';
export { getIndent } from './ml-dom/helper/get-indent.js';
export * from './configs.js';

@@ -8,0 +8,0 @@ export * from './convert-ruleset.js';

export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRole, getImplicitRole, getPermittedRoles, getRoleSpec, getSpec, resolveNamespace, } from '@markuplint/ml-spec';
export { default as Ruleset } from './ruleset/index.js';
export { enableDebug } from './debug.js';
export { getIndent } from './ml-dom/helper/getIndent.js';
export { getIndent } from './ml-dom/helper/get-indent.js';
export * from './configs.js';

@@ -6,0 +6,0 @@ export * from './convert-ruleset.js';

@@ -12,6 +12,6 @@ import type { MLFabric } from './types.js';

#private;
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, }: MLCoreParams);
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, configErrors, }: MLCoreParams);
get document(): ParserError | Document<RuleConfigValue, PlainData>;
setCode(sourceCode: string): void;
update({ parser, ruleset, rules, locale, schemas, parserOptions }: Partial<MLFabric>): void;
update({ parser, ruleset, rules, locale, schemas, parserOptions, configErrors }: Partial<MLFabric>): void;
verify(fix?: boolean): Promise<Violation[]>;

@@ -18,0 +18,0 @@ private _createDocument;

@@ -1,3 +0,13 @@

var _MLCore_ast, _MLCore_document, _MLCore_filename, _MLCore_locale, _MLCore_parser, _MLCore_parserOptions, _MLCore_pretenders, _MLCore_rules, _MLCore_ruleset, _MLCore_schemas, _MLCore_sourceCode;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _MLCore_ast, _MLCore_document, _MLCore_filename, _MLCore_locale, _MLCore_parser, _MLCore_parserOptions, _MLCore_pretenders, _MLCore_rules, _MLCore_ruleset, _MLCore_schemas, _MLCore_sourceCode, _MLCore_configErrors;
import { ParserError } from '@markuplint/parser-utils';

@@ -8,3 +18,3 @@ import { log, enableDebug } from './debug.js';

export class MLCore {
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, }) {
constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, pretenders, filename, debug, configErrors, }) {
_MLCore_ast.set(this, null);

@@ -21,2 +31,3 @@ _MLCore_document.set(this, void 0);

_MLCore_sourceCode.set(this, void 0);
_MLCore_configErrors.set(this, void 0);
if (debug) {

@@ -36,4 +47,5 @@ enableDebug();

__classPrivateFieldSet(this, _MLCore_filename, filename, "f");
__classPrivateFieldSet(this, _MLCore_rules, rules.slice(), "f");
__classPrivateFieldSet(this, _MLCore_pretenders, pretenders.slice(), "f");
__classPrivateFieldSet(this, _MLCore_rules, [...rules], "f");
__classPrivateFieldSet(this, _MLCore_pretenders, [...pretenders], "f");
__classPrivateFieldSet(this, _MLCore_configErrors, [...(configErrors ?? [])], "f");
this._parse();

@@ -50,3 +62,3 @@ this._createDocument();

}
update({ parser, ruleset, rules, locale, schemas, parserOptions }) {
update({ parser, ruleset, rules, locale, schemas, parserOptions, configErrors }) {
__classPrivateFieldSet(this, _MLCore_parser, parser ?? __classPrivateFieldGet(this, _MLCore_parser, "f"), "f");

@@ -61,2 +73,3 @@ __classPrivateFieldSet(this, _MLCore_ruleset, {

__classPrivateFieldSet(this, _MLCore_schemas, schemas ?? __classPrivateFieldGet(this, _MLCore_schemas, "f"), "f");
__classPrivateFieldSet(this, _MLCore_configErrors, [...(configErrors ?? [])], "f");
if (parserOptions &&

@@ -84,2 +97,12 @@ (parserOptions.ignoreFrontMatter !== __classPrivateFieldGet(this, _MLCore_parserOptions, "f").ignoreFrontMatter ||

}
for (const error of __classPrivateFieldGet(this, _MLCore_configErrors, "f")) {
violations.push({
ruleId: 'config-error',
severity: 'warning',
message: error.message,
col: 1,
line: 1,
raw: '',
});
}
for (const rule of __classPrivateFieldGet(this, _MLCore_rules, "f")) {

@@ -91,7 +114,7 @@ const ruleInfo = rule.getRuleInfo(__classPrivateFieldGet(this, _MLCore_ruleset, "f"), rule.name);

log('%s Rule: verify', rule.name);
const results = await rule.verify(__classPrivateFieldGet(this, _MLCore_document, "f"), __classPrivateFieldGet(this, _MLCore_locale, "f"), fix).catch(e => {
if (e instanceof ParserError) {
return e;
const results = await rule.verify(__classPrivateFieldGet(this, _MLCore_document, "f"), __classPrivateFieldGet(this, _MLCore_locale, "f"), fix).catch(error => {
if (error instanceof ParserError) {
return error;
}
throw e;
throw error;
});

@@ -115,2 +138,3 @@ if (results instanceof ParserError) {

if (resultLog.enabled) {
// eslint-disable-next-line unicorn/no-array-reduce
const { e, w, i } = violations.reduce((c, v) => {

@@ -144,8 +168,8 @@ if (v.severity === 'error')

}
catch (err) {
if (err instanceof ParserError) {
__classPrivateFieldSet(this, _MLCore_document, err, "f");
catch (error) {
if (error instanceof ParserError) {
__classPrivateFieldSet(this, _MLCore_document, error, "f");
}
else {
throw err;
throw error;
}

@@ -158,10 +182,10 @@ }

}
catch (err) {
log('Caught the parse error: %O', err);
catch (error) {
log('Caught the parse error: %O', error);
__classPrivateFieldSet(this, _MLCore_ast, null, "f");
if (err instanceof ParserError) {
__classPrivateFieldSet(this, _MLCore_document, err, "f");
if (error instanceof ParserError) {
__classPrivateFieldSet(this, _MLCore_document, error, "f");
}
else {
throw err;
throw error;
}

@@ -171,2 +195,2 @@ }

}
_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();
_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(), _MLCore_configErrors = new WeakMap();

@@ -19,3 +19,3 @@ import { getAccname as get, getComputedRole } from '@markuplint/ml-spec';

if (isFromContent(el, version)) {
return Array.from(el.childNodes)
return [...el.childNodes]
.map(child => {

@@ -41,5 +41,5 @@ if (child.is(child.ELEMENT_NODE)) {

}
catch (err) {
catch (error) {
accnameLog('Raw: %s', el.raw);
accnameLog('Error: %O', err);
accnameLog('Error: %O', error);
return '';

@@ -46,0 +46,0 @@ }

export function nodeListToDebugMaps(
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
nodeList, withAttr = false) {
return nodeList
.map(n => {
return nodeList.flatMap(n => {
const r = [];

@@ -13,6 +12,5 @@ if (n.is(n.ELEMENT_NODE) && n.isOmitted) {

if (n.is(n.ELEMENT_NODE)) {
r.push(` namespaceURI: ${!!n.namespaceURI}`);
r.push(` elementType: ${n.elementType}`);
r.push(` isInFragmentDocument: ${n.isInFragmentDocument()}`);
r.push(` isForeignElement: ${!!n.isForeignElement}`);
r.push(
//
` namespaceURI: ${!!n.namespaceURI}`, ` elementType: ${n.elementType}`, ` isInFragmentDocument: ${n.isInFragmentDocument()}`, ` isForeignElement: ${!!n.isForeignElement}`);
if (withAttr) {

@@ -25,4 +23,3 @@ r.push(...attributesToDebugMaps(n.attributes)

return r;
})
.flat();
});
}

@@ -32,4 +29,3 @@ function attributesToDebugMaps(

attributes) {
return attributes
.map(n => {
return attributes.flatMap(n => {
const r = [

@@ -72,4 +68,5 @@ tokenDebug({

if (n.spacesBeforeName) {
r.push(` isDirective: ${!!n.isDirective}`);
r.push(` isDynamicValue: ${!!n.isDynamicValue}`);
r.push(
//
` isDirective: ${!!n.isDirective}`, ` isDynamicValue: ${!!n.isDynamicValue}`);
}

@@ -80,4 +77,3 @@ if (n.candidate) {

return r;
})
.flat();
});
}

@@ -88,3 +84,3 @@ function tokenDebug(n, type = '') {

function visibleWhiteSpace(chars) {
return chars.replace(/\n/g, '⏎').replace(/\t/g, '→').replace(/\s/g, '␣');
return chars.replaceAll('\n', '⏎').replaceAll('\t', '→').replaceAll(/\s/g, '␣');
}

@@ -6,3 +6,3 @@ export function syncWalk(

if (node.is(node.ELEMENT_NODE) || node.is(node.MARKUPLINT_PREPROCESSOR_BLOCK)) {
syncWalk(Array.from(node.childNodes), walker);
syncWalk([...node.childNodes], walker);
}

@@ -9,0 +9,0 @@ walker(node);

@@ -5,5 +5,5 @@ import { toHTMLCollection } from '../node/node-list.js';

node) {
return toHTMLCollection(Array.from(node.childNodes).filter((child) => {
return toHTMLCollection([...node.childNodes].filter((child) => {
return child.nodeType === child.ELEMENT_NODE;
}));
}

@@ -0,3 +1,13 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _MLAttr_localName, _MLAttr_namespaceURI, _MLAttr_potentialName, _MLAttr_potentialValue;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { resolveNamespace } from '@markuplint/ml-spec';

@@ -4,0 +14,0 @@ import { MLToken } from '../token/token.js';

@@ -0,3 +1,13 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _MLDomTokenList_origin, _MLDomTokenList_ownerAttrs, _MLDomTokenList_set;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { getCol, getLine } from '@markuplint/parser-utils';

@@ -43,3 +53,3 @@ import UnexpectedCallError from './unexpected-call-error.js';

let offset = 0;
const tokens = Array.from(this);
const tokens = [...this];
const locs = [];

@@ -46,0 +56,0 @@ while (tokens.length > 0) {

@@ -1534,2 +1534,6 @@ import type { MLDocument } from './document.js';

/**
* @see https://html.spec.whatwg.org/multipage/scripting.html#dom-slot-assignednodes
*/
assignedNodes(): never[];
/**
* **IT THROWS AN ERROR WHEN CALLING THIS.**

@@ -1536,0 +1540,0 @@ *

@@ -45,8 +45,8 @@ class MLNodeList extends Array {

const collection = new MLHTMLCollection();
nodeList.forEach(node => {
for (const node of nodeList) {
if (node.is(node.ELEMENT_NODE)) {
collection.push(node);
}
});
}
return collection;
}

@@ -0,3 +1,7 @@

var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _NodeStore_store;
import { __classPrivateFieldGet } from "tslib";
import { TargetParserError } from '@markuplint/parser-utils';

@@ -16,3 +20,3 @@ import { log } from '../../debug.js';

nodeStoreError('Ref ID: %s (%s: "%s")', astNode.uuid, astNode.nodeName, astNode.raw);
nodeStoreError('Map: %O', Array.from(__classPrivateFieldGet(this, _NodeStore_store, "f").entries()).map(([id, node]) => ({
nodeStoreError('Map: %O', [...__classPrivateFieldGet(this, _NodeStore_store, "f").entries()].map(([id, node]) => ({
id,

@@ -40,3 +44,3 @@ name: node.nodeName,

}
nodeStoreLog('Mapped: %s (%s: "%s")', astNode.uuid, astNode.nodeName, astNode.raw.replace(/\n/g, '⏎').replace(/\t/g, '→'));
nodeStoreLog('Mapped: %s (%s: "%s")', astNode.uuid, astNode.nodeName, astNode.raw.replaceAll('\n', '⏎').replaceAll('\t', '→'));
__classPrivateFieldGet(this, _NodeStore_store, "f").set(astNode.uuid, node);

@@ -43,0 +47,0 @@ }

@@ -0,3 +1,13 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _MLNode_childNodes, _MLNode_ownerDocument, _MLNode_prevToken;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { MLToken } from '../token/token.js';

@@ -47,3 +57,3 @@ import { isChildNode } from './child-node.js';

*/
this.DOCUMENT_POSITION_CONTAINS = 8;
this.DOCUMENT_POSITION_CONTAINS = 0b1000;
/**

@@ -210,2 +220,3 @@ * @implements DOM API: `Node`

get lastChild() {
// eslint-disable-next-line unicorn/prefer-at
return this.childNodes[this.childNodes.length - 1] ?? null;

@@ -212,0 +223,0 @@ }

@@ -0,3 +1,13 @@

var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var _MLParentNode_children, _MLParentNode_selectedElements;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { syncWalk } from '../helper/walkers.js';

@@ -120,3 +130,3 @@ import { getChildren } from '../manipulations/get-children.js';

const nodeList = [];
syncWalk(Array.from(this.childNodes), node => {
syncWalk([...this.childNodes], node => {
if (filter) {

@@ -123,0 +133,0 @@ const filtered = filter(node);

@@ -0,3 +1,13 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _RuleMapper_nodeList, _RuleMapper_ruleMap;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { compareSpecificity } from '@markuplint/selector';

@@ -18,17 +28,17 @@ import { log as coreLog } from '../../debug.js';

ruleMapperLog('ruleTree:');
__classPrivateFieldGet(this, _RuleMapper_nodeList, "f").forEach(node => {
for (const node of __classPrivateFieldGet(this, _RuleMapper_nodeList, "f")) {
const rules = __classPrivateFieldGet(this, _RuleMapper_ruleMap, "f").get(node.uuid);
if (!rules) {
return;
continue;
}
ruleMapperNodeLog('<%s>', node.nodeName);
Object.keys(rules).forEach(ruleName => {
for (const ruleName of Object.keys(rules)) {
const rule = rules[ruleName];
if (!rule) {
return;
continue;
}
node.rules[ruleName] = rule.rule;
ruleMapperNodeRuleLog('[from: %s(%s)] %s: %o', rule.from, rule.specificity, ruleName, rule.rule);
});
});
}
}
}

@@ -35,0 +45,0 @@ set(

@@ -8,3 +8,3 @@ import { MLCharacterData } from './character-data.js';

*/
const rawTextElements = ['script', 'style'];
const rawTextElements = new Set(['script', 'style']);
export class MLText extends MLCharacterData {

@@ -54,3 +54,3 @@ /**

isRawTextElementContent() {
return this.parentElement ? rawTextElements.includes(this.parentElement.nodeName.toLowerCase()) : false;
return this.parentElement ? rawTextElements.has(this.parentElement.nodeName.toLowerCase()) : false;
}

@@ -57,0 +57,0 @@ /**

@@ -36,7 +36,11 @@ import type { MLAttr } from './attr.js';

};
export type AccessibilityProperties = {
export type AccessibilityProperties = ClearlyAccessibilityProperties | UnknownAccessibilityProperties;
export type ClearlyAccessibilityProperties = {
unknown: false;
exposedToTree: boolean;
role?: string;
roleDescription?: string;
name?: string;
name?: string | {
unknown: true;
};
nameRequired?: boolean;

@@ -47,2 +51,5 @@ nameProhibited?: boolean;

};
export type UnknownAccessibilityProperties = {
unknown: true;
};
export type AccessibilityProperty = {

@@ -49,0 +56,0 @@ value: string | null;

@@ -0,3 +1,13 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _MLToken_endCol, _MLToken_endLine, _MLToken_endOffset, _MLToken_fixed, _MLToken_raw, _MLToken_startCol, _MLToken_startLine, _MLToken_startOffset;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
export class MLToken {

@@ -4,0 +14,0 @@ constructor(astToken) {

@@ -0,3 +1,7 @@

var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _MLRuleContext_reports;
import { __classPrivateFieldGet } from "tslib";
import { translator } from '@markuplint/i18n';

@@ -40,3 +44,3 @@ export class MLRuleContext {

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

@@ -43,0 +47,0 @@ }

@@ -0,3 +1,13 @@

var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) {
if (kind === "m") throw new TypeError("Private method is not writable");
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it");
return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value;
};
var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) {
if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter");
if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it");
return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver);
};
var _MLRule_f, _MLRule_v;
import { __classPrivateFieldGet, __classPrivateFieldSet } from "tslib";
import { deleteUndefProp } from '@markuplint/ml-config';

@@ -14,3 +24,3 @@ // @ts-ignore

// TODO: https://github.com/markuplint/markuplint/issues/808
this.defaultValue = (o.defaultValue !== undefined ? o.defaultValue : true);
this.defaultValue = (o.defaultValue === undefined ? true : o.defaultValue);
this.defaultOptions = o.defaultOptions;

@@ -17,0 +27,0 @@ __classPrivateFieldSet(this, _MLRule_v, o.verify, "f");

@@ -25,3 +25,3 @@ import { parse } from '@markuplint/html-parser';

}
throw TypeError(`Could not parse it to be an element from: ${sourceCode}`);
throw new TypeError(`Could not parse it to be an element from: ${sourceCode}`);
}

@@ -28,0 +28,0 @@ /**

export function getLocationFromChars(searches, text, currentLine, currentCol) {
const lines = text.split(/\r?\n/g);
const foundLocations = [];
lines.forEach((lineText, i) => {
for (const [i, lineText] of lines.entries()) {
let offset = 0;

@@ -22,4 +22,4 @@ for (const char of lineText) {

}
});
}
return foundLocations;
}
{
"name": "@markuplint/ml-core",
"version": "4.0.0-alpha.3",
"version": "4.0.0-dev.28+0131de5e",
"description": "The core module of markuplint",

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

"dependencies": {
"@markuplint/config-presets": "4.0.0-alpha.3",
"@markuplint/html-parser": "4.0.0-alpha.3",
"@markuplint/html-spec": "4.0.0-alpha.3",
"@markuplint/i18n": "4.0.0-alpha.3",
"@markuplint/ml-ast": "4.0.0-alpha.3",
"@markuplint/ml-config": "4.0.0-alpha.3",
"@markuplint/ml-spec": "4.0.0-alpha.3",
"@markuplint/parser-utils": "4.0.0-alpha.3",
"@markuplint/selector": "4.0.0-alpha.3",
"@types/debug": "^4.1.9",
"@markuplint/config-presets": "4.0.0-dev.28+0131de5e",
"@markuplint/html-parser": "4.0.0-dev.28+0131de5e",
"@markuplint/html-spec": "4.0.0-dev.28+0131de5e",
"@markuplint/i18n": "4.0.0-dev.28+0131de5e",
"@markuplint/ml-ast": "4.0.0-dev.28+0131de5e",
"@markuplint/ml-config": "4.0.0-dev.28+0131de5e",
"@markuplint/ml-spec": "4.0.0-dev.28+0131de5e",
"@markuplint/parser-utils": "4.0.0-dev.28+0131de5e",
"@markuplint/selector": "4.0.0-dev.28+0131de5e",
"@types/debug": "^4.1.10",
"debug": "^4.3.4",
"is-plain-object": "^5.0.0",
"tslib": "^2.6.2",
"type-fest": "^4.3.1"
"type-fest": "^4.5.0"
},
"gitHead": "380836f7adc1ff7e8eaf9d869e68d29eee8f3b7e"
"gitHead": "0131de5ea9dd6d3fd5472d7b414b66644c758881"
}

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

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

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