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 2.0.0-dev.20220105.1 to 2.0.0-dev.20220106.0

2

lib/ml-core.d.ts

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

constructor({ parser, sourceCode, ruleset, rules, locale, schemas, parserOptions, filename, debug }: MLCoreParams);
get document(): MLParseError | Document<RuleConfigValue, unknown>;
get document(): Document<RuleConfigValue, unknown> | MLParseError;
verify(fix?: boolean): Promise<Violation[]>;

@@ -16,0 +16,0 @@ setCode(sourceCode: string): void;

@@ -88,14 +88,16 @@ "use strict";

}
const { e, w, i } = violations.reduce((c, v) => {
if (v.severity === 'error')
c.e += 1;
if (v.severity === 'warning')
c.w += 1;
if (v.severity === 'info')
c.i += 1;
return c;
}, { e: 0, w: 0, i: 0 });
resultLog('Error: %d', e);
resultLog('Warning: %d', w);
resultLog('Info: %d', i);
if (resultLog.enabled) {
const { e, w, i } = violations.reduce((c, v) => {
if (v.severity === 'error')
c.e += 1;
if (v.severity === 'warning')
c.w += 1;
if (v.severity === 'info')
c.i += 1;
return c;
}, { e: 0, w: 0, i: 0 });
resultLog('Error: %d', e);
resultLog('Warning: %d', w);
resultLog('Info: %d', i);
}
(0, debug_1.log)('verify: end');

@@ -102,0 +104,0 @@ return violations;

@@ -135,3 +135,5 @@ "use strict";

}
docLog('Add rules to node <%s>', 'nodeName' in node ? node.nodeName : `#${node.type}`);
if (docLog.enabled) {
docLog('Add rules to node <%s>', 'nodeName' in node ? node.nodeName : `#${node.type}`);
}
// global rules

@@ -176,3 +178,5 @@ Object.keys(ruleset.rules).forEach(ruleName => {

}
docLog('Matched nodeRule: <%s>(%s)', 'nodeName' in node ? node.nodeName : node.type, matches.selector || '*');
if (docLog.enabled) {
docLog('Matched nodeRule: <%s>(%s)', 'nodeName' in node ? node.nodeName : node.type, matches.selector || '*');
}
const ruleList = Object.keys(nodeRule.rules);

@@ -218,3 +222,5 @@ for (const ruleName of ruleList) {

}
docLog('Matched childNodeRule: <%s>(%s), inheritance: %o', selectorTarget.nodeName, matches.selector || '*', !!nodeRule.inheritance);
if (docLog.enabled) {
docLog('Matched childNodeRule: <%s>(%s), inheritance: %o', selectorTarget.nodeName, matches.selector || '*', !!nodeRule.inheritance);
}
const targetDescendants = nodeRule.inheritance ? descendants : children;

@@ -221,0 +227,0 @@ Object.keys(nodeRuleRules).forEach(ruleName => {

@@ -43,2 +43,3 @@ import type { AnonymousNode, Document } from '../';

isDescendantByUUIDList(uuidList: string[]): boolean;
toNormalizeString(): string;
}
"use strict";
var _MLDOMAbstractElement_fixedNodeName;
var _MLDOMAbstractElement_fixedNodeName, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, _MLDOMAbstractElement_normalizedString;
Object.defineProperty(exports, "__esModule", { value: true });

@@ -18,2 +18,4 @@ const tslib_1 = require("tslib");

_MLDOMAbstractElement_fixedNodeName.set(this, void 0);
_MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache.set(this, null);
_MLDOMAbstractElement_normalizedString.set(this, null);
this.nodeName = astNode.nodeName;

@@ -155,2 +157,5 @@ (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMAbstractElement_fixedNodeName, astNode.nodeName, "f");

getChildElementsAndTextNodeWithoutWhitespaces() {
if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f")) {
return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f");
}
const filteredNodes = [];

@@ -169,2 +174,3 @@ this.childNodes.forEach(node => {

});
(0, tslib_1.__classPrivateFieldSet)(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, filteredNodes, "f");
return filteredNodes;

@@ -191,4 +197,23 @@ }

}
toNormalizeString() {
if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_normalizedString, "f")) {
return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_normalizedString, "f");
}
const children = this.getChildElementsAndTextNodeWithoutWhitespaces();
const attrs = this.attributes.map(attr => attr.toNormalizeString());
const attrString = attrs.length ? ' ' + attrs.join('') : '';
const startTag = `<${this.nodeName}${attrString}>`;
const childNodes = children.map(node => {
if (node.type === 'Element') {
return node.toNormalizeString();
}
return node.originRaw;
});
const endTag = `</${this.nodeName}>`;
const normalizedString = `${startTag}${childNodes.join('')}${endTag}`;
(0, tslib_1.__classPrivateFieldSet)(this, _MLDOMAbstractElement_normalizedString, normalizedString, "f");
return normalizedString;
}
}
exports.default = MLDOMAbstractElement;
_MLDOMAbstractElement_fixedNodeName = new WeakMap();
_MLDOMAbstractElement_fixedNodeName = new WeakMap(), _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache = new WeakMap(), _MLDOMAbstractElement_normalizedString = new WeakMap();

@@ -39,2 +39,3 @@ import type { MLASTHTMLAttr, MLToken } from '@markuplint/ml-ast';

toString(withSpace?: boolean): string;
toNormalizeString(): string;
}

@@ -72,3 +72,10 @@ "use strict";

}
toNormalizeString() {
return (this.name.originRaw +
this.equal.originRaw +
this.startQuote.originRaw +
this.value.originRaw +
this.endQuote.originRaw);
}
}
exports.default = MLDOMAttribute;

@@ -23,2 +23,3 @@ import type { MLASTPreprocessorSpecificAttr } from '@markuplint/ml-ast';

toString(): string;
toNormalizeString(): string;
}

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

}
toNormalizeString() {
return this.raw;
}
}
exports.default = MLDOMPreprocessorSpecificAttribute;
{
"name": "@markuplint/ml-core",
"version": "2.0.0-dev.20220105.1",
"version": "2.0.0-dev.20220106.0",
"description": "The core module of markuplint",

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

"@markuplint/ml-config": "2.0.0-dev.2021116.3",
"@markuplint/ml-spec": "2.0.0-dev.20211227.1",
"@markuplint/ml-spec": "2.0.0-dev.20220106.0",
"debug": "^4.3.2",

@@ -30,6 +30,6 @@ "postcss-selector-parser": "^6.0.6",

"devDependencies": {
"@markuplint/html-parser": "2.0.0-dev.20220105.1",
"@markuplint/html-parser": "2.0.0-dev.20220106.0",
"@types/debug": "^4.1.7"
},
"gitHead": "73fab2765c080b0a42e71bdc1eed09bae0ed360e"
"gitHead": "ae095a6ca5d8ee8590fe21310c097b47d6d79486"
}

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