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
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-rc.5 to 2.0.0-rc.6

1

lib/index.d.ts

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

export * from './ml-rule';
export { default as MLParseError } from './ml-error/ml-parse-error';
export { default as Ruleset } from './ruleset';

@@ -9,0 +8,0 @@ export * from './ml-dom';

4

lib/index.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.enableDebug = exports.getIndent = exports.Ruleset = exports.MLParseError = exports.getAttrSpecs = void 0;
exports.enableDebug = exports.getIndent = exports.Ruleset = exports.getAttrSpecs = void 0;
const tslib_1 = require("tslib");

@@ -10,4 +10,2 @@ var ml_spec_1 = require("@markuplint/ml-spec");

(0, tslib_1.__exportStar)(require("./ml-rule"), exports);
var ml_parse_error_1 = require("./ml-error/ml-parse-error");
Object.defineProperty(exports, "MLParseError", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ml_parse_error_1).default; } });
var ruleset_1 = require("./ruleset");

@@ -14,0 +12,0 @@ Object.defineProperty(exports, "Ruleset", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ruleset_1).default; } });

import type { MLFabric } from './types';
import type { RuleConfigValue, Violation } from '@markuplint/ml-config';
import { ParserError } from '@markuplint/parser-utils';
import { Document } from './ml-dom';
import MLParseError from './ml-error/ml-parse-error';
export declare type MLCoreParams = {

@@ -13,7 +13,8 @@ sourceCode: string;

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

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

const tslib_1 = require("tslib");
const parser_utils_1 = require("@markuplint/parser-utils");
const debug_1 = require("./debug");
const ml_dom_1 = require("./ml-dom");
const ml_parse_error_1 = (0, tslib_1.__importDefault)(require("./ml-error/ml-parse-error"));
const _1 = require(".");
const resultLog = debug_1.log.extend('result');

@@ -19,3 +18,3 @@ class MLCore {

_MLCore_sourceCode.set(this, void 0);
_MLCore_ast.set(this, void 0);
_MLCore_ast.set(this, null);
_MLCore_ruleset.set(this, void 0);

@@ -26,2 +25,5 @@ _MLCore_locale.set(this, void 0);

_MLCore_ignoreFrontMatter.set(this, void 0);
if (debug) {
(0, debug_1.enableDebug)();
}
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_parser, parser, "f");

@@ -37,8 +39,5 @@ (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_sourceCode, sourceCode, "f");

(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_schemas, schemas, "f");
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ast, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").parse((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_sourceCode, "f"), 0, 0, 0, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ignoreFrontMatter, "f")), "f");
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_filename, filename, "f");
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_rules, rules, "f");
if (debug) {
(0, _1.enableDebug)();
}
this._parse();
this._createDocument();

@@ -52,3 +51,3 @@ }

const violations = [];
if ((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f") instanceof ml_parse_error_1.default) {
if ((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f") instanceof parser_utils_1.ParserError) {
violations.push({

@@ -72,3 +71,3 @@ ruleId: 'parse-error',

const results = await rule.verify((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f"), (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_locale, "f"), ruleInfo, fix).catch(e => {
if (e instanceof ml_parse_error_1.default) {
if (e instanceof parser_utils_1.ParserError) {
return e;

@@ -78,3 +77,3 @@ }

});
if (results instanceof ml_parse_error_1.default) {
if (results instanceof parser_utils_1.ParserError) {
(0, debug_1.log)('%s Rule: verify error %o', rule.name, results.message);

@@ -114,3 +113,3 @@ violations.push({

(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_sourceCode, sourceCode, "f");
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ast, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").parse((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_sourceCode, "f"), 0, 0, 0, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ignoreFrontMatter, "f")), "f");
this._parse();
this._createDocument();

@@ -130,7 +129,25 @@ }

if (parserOptions && parserOptions.ignoreFrontMatter !== (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ignoreFrontMatter, "f")) {
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ast, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").parse((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_sourceCode, "f"), 0, 0, 0, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ignoreFrontMatter, "f")), "f");
this._parse();
}
this._createDocument();
}
_parse() {
try {
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ast, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").parse((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_sourceCode, "f"), 0, 0, 0, (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ignoreFrontMatter, "f")), "f");
}
catch (err) {
(0, debug_1.log)('Caught the parse error: %O', err);
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ast, null, "f");
if (err instanceof parser_utils_1.ParserError) {
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_document, err, "f");
}
else {
throw err;
}
}
}
_createDocument() {
if (!(0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ast, "f")) {
return;
}
try {

@@ -140,6 +157,7 @@ (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_document, new ml_dom_1.Document((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ast, "f"), (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ruleset, "f"), (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_schemas, "f"), {

tagNameCaseSensitive: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").tagNameCaseSensitive,
endTag: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").endTag,
}), "f");
}
catch (err) {
if (err instanceof ml_parse_error_1.default) {
if (err instanceof parser_utils_1.ParserError) {
(0, tslib_1.__classPrivateFieldSet)(this, _MLCore_document, err, "f");

@@ -146,0 +164,0 @@ }

@@ -35,2 +35,6 @@ import type { MLRule } from '../';

*/
readonly endTag: 'xml' | 'omittable' | 'never';
/**
*
*/
readonly nodeStore: NodeStore;

@@ -49,2 +53,3 @@ /**

tagNameCaseSensitive?: boolean;
endTag?: 'xml' | 'omittable' | 'never';
});

@@ -51,0 +56,0 @@ get doctype(): MLDOMDoctype<T, O> | null;

@@ -27,2 +27,3 @@ "use strict";

constructor(ast, ruleset, schemas, options) {
var _a;
/**

@@ -39,2 +40,3 @@ *

this.specs = (0, ml_spec_1.getSpec)(schemas);
this.endTag = (_a = options === null || options === void 0 ? void 0 : options.endTag) !== null && _a !== void 0 ? _a : 'omittable';
(0, tslib_1.__classPrivateFieldSet)(this, _MLDOMDocument_filename, options === null || options === void 0 ? void 0 : options.filename, "f");

@@ -41,0 +43,0 @@ // console.log(ast.nodeList.map((n, i) => `${i}: ${n.uuid} "${n.raw.trim()}"(${n.type})`));

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

const tslib_1 = require("tslib");
const ml_parse_error_1 = (0, tslib_1.__importDefault)(require("../../ml-error/ml-parse-error"));
const parser_utils_1 = require("@markuplint/parser-utils");
class NodeStore {

@@ -18,3 +18,8 @@ constructor() {

if (!node) {
throw new ml_parse_error_1.default(astNode.startLine, astNode.startCol, astNode.raw, astNode.nodeName);
throw new parser_utils_1.ParserError('Broke mapping nodes.', {
line: astNode.startLine,
col: astNode.startCol,
raw: astNode.raw,
nodeName: astNode.nodeName,
});
}

@@ -21,0 +26,0 @@ return node;

@@ -16,2 +16,3 @@ {

"doctype": true,
"end-tag": false,
"id-duplication": true,

@@ -18,0 +19,0 @@ "indentation": false,

{
"name": "@markuplint/ml-core",
"version": "2.0.0-rc.5",
"version": "2.0.0-rc.6",
"description": "The core module of markuplint",

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

"dependencies": {
"@markuplint/i18n": "2.0.0-rc.4",
"@markuplint/ml-ast": "2.0.0-rc.5",
"@markuplint/i18n": "2.0.0-rc.5",
"@markuplint/ml-ast": "2.0.0-rc.6",
"@markuplint/ml-config": "2.0.0-rc.5",
"@markuplint/ml-spec": "2.0.0-rc.5",
"@markuplint/ml-spec": "2.0.0-rc.6",
"@markuplint/parser-utils": "2.0.0-rc.6",
"debug": "^4.3.2",

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

"devDependencies": {
"@markuplint/html-parser": "2.0.0-rc.5",
"@markuplint/html-parser": "2.0.0-rc.6",
"@types/debug": "^4.1.7"
},
"gitHead": "6faa4e54f16d3700d23953330abea89ccb9d6150"
"gitHead": "7c93367a86f935f6b94780b1fa14f3293f900b87"
}

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