@markuplint/ml-core
Advanced tools
Comparing version 1.0.0-alpha.3 to 1.0.0-alpha.5
import { Messenger } from '@markuplint/i18n'; | ||
import { MLMarkupLanguageParser } from '@markuplint/ml-ast'; | ||
import { RuleConfigValue, VerifiedResult } from '@markuplint/ml-config'; | ||
import { MLMLSpec } from '@markuplint/ml-spec'; | ||
import { MLRule } from './ml-rule'; | ||
@@ -10,2 +11,3 @@ import Ruleset from './ruleset'; | ||
private _ast; | ||
private _specs; | ||
private _document; | ||
@@ -15,3 +17,3 @@ private _ruleset; | ||
private _rules; | ||
constructor(parser: MLMarkupLanguageParser, sourceCode: string, ruleset: Ruleset, rules: MLRule<RuleConfigValue, unknown>[], messenger: Messenger); | ||
constructor(parser: MLMarkupLanguageParser, sourceCode: string, specs: MLMLSpec, ruleset: Ruleset, rules: MLRule<RuleConfigValue, unknown>[], messenger: Messenger); | ||
verify(): Promise<VerifiedResult[]>; | ||
@@ -18,0 +20,0 @@ fix(): Promise<void>; |
@@ -38,11 +38,13 @@ "use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ml_spec_1 = require("@markuplint/ml-spec"); | ||
var ml_dom_1 = require("./ml-dom"); | ||
var MLCore = /** @class */ (function () { | ||
function MLCore(parser, sourceCode, ruleset, rules, messenger) { | ||
function MLCore(parser, sourceCode, specs, ruleset, rules, messenger) { | ||
this._parser = parser; | ||
this._sourceCode = sourceCode; | ||
this._specs = ml_spec_1.getSpecOM(specs); | ||
this._ruleset = ruleset; | ||
this._messenger = messenger; | ||
this._ast = this._parser.parse(this._sourceCode); | ||
this._document = new ml_dom_1.Document(this._ast, this._ruleset); | ||
this._document = new ml_dom_1.Document(this._ast, this._specs, this._ruleset); | ||
this._rules = rules; | ||
@@ -89,3 +91,3 @@ } | ||
this._ast = this._parser.parse(this._sourceCode); | ||
this._document = new ml_dom_1.Document(this._ast, this._ruleset); | ||
this._document = new ml_dom_1.Document(this._ast, this._specs, this._ruleset); | ||
}; | ||
@@ -95,7 +97,7 @@ MLCore.prototype.setCode = function (sourceCode) { | ||
this._ast = this._parser.parse(this._sourceCode); | ||
this._document = new ml_dom_1.Document(this._ast, this._ruleset); | ||
this._document = new ml_dom_1.Document(this._ast, this._specs, this._ruleset); | ||
}; | ||
MLCore.prototype.setRuleset = function (ruleset) { | ||
this._ruleset = ruleset; | ||
this._document = new ml_dom_1.Document(this._ast, this._ruleset); | ||
this._document = new ml_dom_1.Document(this._ast, this._specs, this._ruleset); | ||
}; | ||
@@ -102,0 +104,0 @@ return MLCore; |
import { MLASTDocument } from '@markuplint/ml-ast'; | ||
import { RuleConfigValue } from '@markuplint/ml-config'; | ||
import { SpecOM } from '@markuplint/ml-spec'; | ||
import { MLRule } from '../'; | ||
@@ -16,2 +17,6 @@ import Ruleset from '../ruleset'; | ||
/** | ||
* Specs | ||
*/ | ||
specs: SpecOM; | ||
/** | ||
* | ||
@@ -29,3 +34,3 @@ */ | ||
*/ | ||
constructor(ast: MLASTDocument, ruleset: Ruleset); | ||
constructor(ast: MLASTDocument, specs: SpecOM, ruleset: Ruleset); | ||
walk(walker: Walker<T, O>): Promise<void>; | ||
@@ -32,0 +37,0 @@ walkOn(type: 'Element', walker: Walker<T, O, MLDOMElement<T, O>>): Promise<void>; |
@@ -49,3 +49,3 @@ "use strict"; | ||
*/ | ||
function MLDOMDocument(ast, ruleset) { | ||
function MLDOMDocument(ast, specs, ruleset) { | ||
var _this = this; | ||
@@ -57,2 +57,3 @@ /** | ||
this.nodeList = Object.freeze(ast.nodeList.map(function (astNode) { return helper_1.createNode(astNode, _this); })); | ||
this.specs = specs; | ||
this.isFragment = ast.isFragment; | ||
@@ -82,6 +83,2 @@ // add rules to node | ||
} | ||
// specs | ||
node.categories = nodeRule.categories || []; | ||
node.roles = nodeRule.roles || []; | ||
node.obsolete = !!nodeRule.obsolete; | ||
if (!nodeRule.rules) { | ||
@@ -88,0 +85,0 @@ continue; |
@@ -13,5 +13,2 @@ import { MLASTElement } from '@markuplint/ml-ast'; | ||
readonly closeTag: MLDOMElementCloseTag<T, O> | null; | ||
categories: string[]; | ||
roles: string[]; | ||
obsolete: boolean; | ||
constructor(astNode: MLASTElement, document: Document<T, O>); | ||
@@ -18,0 +15,0 @@ readonly childNodes: AnonymousNode<T, O>[]; |
@@ -23,5 +23,2 @@ "use strict"; | ||
_this.type = 'Element'; | ||
_this.categories = []; | ||
_this.roles = []; | ||
_this.obsolete = false; | ||
_this.nodeName = astNode.nodeName; | ||
@@ -28,0 +25,0 @@ _this.attributes = astNode.attributes.map(function (attr) { return new _1.MLDOMAttribute(attr); }); |
{ | ||
"name": "@markuplint/ml-core", | ||
"version": "1.0.0-alpha.3", | ||
"version": "1.0.0-alpha.5", | ||
"description": "The core module of markuplint", | ||
@@ -16,11 +16,13 @@ "repository": "git@github.com:markuplint/markuplint.git", | ||
"build": "tsc", | ||
"dev": "tsc --build --watch", | ||
"clean": "tsc --build --clean" | ||
}, | ||
"dependencies": { | ||
"@markuplint/i18n": "^1.0.0-alpha.2", | ||
"@markuplint/ml-ast": "^1.0.0-alpha.2", | ||
"@markuplint/ml-config": "^1.0.0-alpha.2", | ||
"@markuplint/i18n": "^1.0.0-alpha.3", | ||
"@markuplint/ml-ast": "^1.0.0-alpha.3", | ||
"@markuplint/ml-config": "^1.0.0-alpha.3", | ||
"@markuplint/ml-spec": "^1.0.0-alpha.1", | ||
"css-selector-parser": "^1.3.0" | ||
}, | ||
"gitHead": "04f46c34858d5980604f23e86349584f0575ef97" | ||
"gitHead": "de677b589bf54651f23d23c7766d113b097053ce" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
207133
5
+ Added@markuplint/ml-spec@1.7.0(transitive)