@markuplint/ml-core 2.1.1-dev.20220307.1 → 2.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.convertRuleset = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const ruleset_1 = (0, tslib_1.__importDefault)(require("./ruleset"));
5
+ const ruleset_1 = tslib_1.__importDefault(require("./ruleset"));
6
6
  function convertRuleset(config = {}) {
7
7
  return new ruleset_1.default(config);
8
8
  }
package/lib/debug.js CHANGED
@@ -2,7 +2,7 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.enableDebug = exports.log = void 0;
4
4
  const tslib_1 = require("tslib");
5
- const debug_1 = (0, tslib_1.__importDefault)(require("debug"));
5
+ const debug_1 = tslib_1.__importDefault(require("debug"));
6
6
  const CLI_NS = 'markuplint-cli';
7
7
  exports.log = (0, debug_1.default)('ml-core');
8
8
  function enableDebug() {
package/lib/index.js CHANGED
@@ -4,18 +4,18 @@ exports.enableDebug = exports.getIndent = exports.Ruleset = exports.getAttrSpecs
4
4
  const tslib_1 = require("tslib");
5
5
  var ml_spec_1 = require("@markuplint/ml-spec");
6
6
  Object.defineProperty(exports, "getAttrSpecs", { enumerable: true, get: function () { return ml_spec_1.getAttrSpecs; } });
7
- (0, tslib_1.__exportStar)(require("./convert-ruleset"), exports);
8
- (0, tslib_1.__exportStar)(require("./ml-core"), exports);
9
- (0, tslib_1.__exportStar)(require("./ml-rule"), exports);
7
+ tslib_1.__exportStar(require("./convert-ruleset"), exports);
8
+ tslib_1.__exportStar(require("./ml-core"), exports);
9
+ tslib_1.__exportStar(require("./ml-rule"), exports);
10
10
  var ruleset_1 = require("./ruleset");
11
- Object.defineProperty(exports, "Ruleset", { enumerable: true, get: function () { return (0, tslib_1.__importDefault)(ruleset_1).default; } });
12
- (0, tslib_1.__exportStar)(require("./ml-dom"), exports);
13
- (0, tslib_1.__exportStar)(require("./plugin"), exports);
11
+ Object.defineProperty(exports, "Ruleset", { enumerable: true, get: function () { return tslib_1.__importDefault(ruleset_1).default; } });
12
+ tslib_1.__exportStar(require("./ml-dom"), exports);
13
+ tslib_1.__exportStar(require("./plugin"), exports);
14
14
  var getIndent_1 = require("./ml-dom/helper/getIndent");
15
15
  Object.defineProperty(exports, "getIndent", { enumerable: true, get: function () { return getIndent_1.getIndent; } });
16
- (0, tslib_1.__exportStar)(require("./utils"), exports);
17
- (0, tslib_1.__exportStar)(require("./types"), exports);
18
- (0, tslib_1.__exportStar)(require("./configs"), exports);
19
- (0, tslib_1.__exportStar)(require("./test"), exports);
16
+ tslib_1.__exportStar(require("./utils"), exports);
17
+ tslib_1.__exportStar(require("./types"), exports);
18
+ tslib_1.__exportStar(require("./configs"), exports);
19
+ tslib_1.__exportStar(require("./test"), exports);
20
20
  var debug_1 = require("./debug");
21
21
  Object.defineProperty(exports, "enableDebug", { enumerable: true, get: function () { return debug_1.enableDebug; } });
package/lib/ml-core.js CHANGED
@@ -23,46 +23,46 @@ class MLCore {
23
23
  if (debug) {
24
24
  (0, debug_1.enableDebug)();
25
25
  }
26
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_parser, parser, "f");
27
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_sourceCode, sourceCode, "f");
28
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ignoreFrontMatter, !!parserOptions.ignoreFrontMatter, "f");
29
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ruleset, {
26
+ tslib_1.__classPrivateFieldSet(this, _MLCore_parser, parser, "f");
27
+ tslib_1.__classPrivateFieldSet(this, _MLCore_sourceCode, sourceCode, "f");
28
+ tslib_1.__classPrivateFieldSet(this, _MLCore_ignoreFrontMatter, !!parserOptions.ignoreFrontMatter, "f");
29
+ tslib_1.__classPrivateFieldSet(this, _MLCore_ruleset, {
30
30
  rules: (_a = ruleset.rules) !== null && _a !== void 0 ? _a : {},
31
31
  nodeRules: (_b = ruleset.nodeRules) !== null && _b !== void 0 ? _b : [],
32
32
  childNodeRules: (_c = ruleset.childNodeRules) !== null && _c !== void 0 ? _c : [],
33
33
  }, "f");
34
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_locale, locale, "f");
35
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_schemas, schemas, "f");
36
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_filename, filename, "f");
37
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_rules, rules, "f");
34
+ tslib_1.__classPrivateFieldSet(this, _MLCore_locale, locale, "f");
35
+ tslib_1.__classPrivateFieldSet(this, _MLCore_schemas, schemas, "f");
36
+ tslib_1.__classPrivateFieldSet(this, _MLCore_filename, filename, "f");
37
+ tslib_1.__classPrivateFieldSet(this, _MLCore_rules, rules, "f");
38
38
  this._parse();
39
39
  this._createDocument();
40
40
  }
41
41
  get document() {
42
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f");
42
+ return tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f");
43
43
  }
44
44
  async verify(fix = false) {
45
45
  (0, debug_1.log)('verify: start');
46
46
  const violations = [];
47
- if ((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f") instanceof parser_utils_1.ParserError) {
47
+ if (tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f") instanceof parser_utils_1.ParserError) {
48
48
  violations.push({
49
49
  ruleId: 'parse-error',
50
50
  severity: 'error',
51
- message: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f").message,
52
- col: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f").col,
53
- line: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f").line,
54
- raw: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f").raw,
51
+ message: tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f").message,
52
+ col: tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f").col,
53
+ line: tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f").line,
54
+ raw: tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f").raw,
55
55
  });
56
- (0, debug_1.log)('verify: error %o', (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_document, "f").message);
56
+ (0, debug_1.log)('verify: error %o', tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f").message);
57
57
  return violations;
58
58
  }
59
- for (const rule of (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_rules, "f")) {
60
- const ruleInfo = rule.getRuleInfo((0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ruleset, "f"), rule.name);
59
+ for (const rule of tslib_1.__classPrivateFieldGet(this, _MLCore_rules, "f")) {
60
+ const ruleInfo = rule.getRuleInfo(tslib_1.__classPrivateFieldGet(this, _MLCore_ruleset, "f"), rule.name);
61
61
  if (ruleInfo.disabled && ruleInfo.nodeRules.length === 0 && ruleInfo.childNodeRules.length === 0) {
62
62
  continue;
63
63
  }
64
64
  (0, debug_1.log)('%s Rule: verify', rule.name);
65
- 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 => {
65
+ const results = await rule.verify(tslib_1.__classPrivateFieldGet(this, _MLCore_document, "f"), tslib_1.__classPrivateFieldGet(this, _MLCore_locale, "f"), ruleInfo, fix).catch(e => {
66
66
  if (e instanceof parser_utils_1.ParserError) {
67
67
  return e;
68
68
  }
@@ -102,35 +102,35 @@ class MLCore {
102
102
  return violations;
103
103
  }
104
104
  setCode(sourceCode) {
105
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_sourceCode, sourceCode, "f");
105
+ tslib_1.__classPrivateFieldSet(this, _MLCore_sourceCode, sourceCode, "f");
106
106
  this._parse();
107
107
  this._createDocument();
108
108
  }
109
109
  update({ parser, ruleset, rules, locale, schemas, parserOptions }) {
110
110
  var _a, _b, _c;
111
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_parser, parser !== null && parser !== void 0 ? parser : (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f"), "f");
112
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ruleset, {
113
- rules: (_a = ruleset === null || ruleset === void 0 ? void 0 : ruleset.rules) !== null && _a !== void 0 ? _a : (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ruleset, "f").rules,
114
- nodeRules: (_b = ruleset === null || ruleset === void 0 ? void 0 : ruleset.nodeRules) !== null && _b !== void 0 ? _b : (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ruleset, "f").nodeRules,
115
- childNodeRules: (_c = ruleset === null || ruleset === void 0 ? void 0 : ruleset.childNodeRules) !== null && _c !== void 0 ? _c : (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ruleset, "f").childNodeRules,
111
+ tslib_1.__classPrivateFieldSet(this, _MLCore_parser, parser !== null && parser !== void 0 ? parser : tslib_1.__classPrivateFieldGet(this, _MLCore_parser, "f"), "f");
112
+ tslib_1.__classPrivateFieldSet(this, _MLCore_ruleset, {
113
+ rules: (_a = ruleset === null || ruleset === void 0 ? void 0 : ruleset.rules) !== null && _a !== void 0 ? _a : tslib_1.__classPrivateFieldGet(this, _MLCore_ruleset, "f").rules,
114
+ nodeRules: (_b = ruleset === null || ruleset === void 0 ? void 0 : ruleset.nodeRules) !== null && _b !== void 0 ? _b : tslib_1.__classPrivateFieldGet(this, _MLCore_ruleset, "f").nodeRules,
115
+ childNodeRules: (_c = ruleset === null || ruleset === void 0 ? void 0 : ruleset.childNodeRules) !== null && _c !== void 0 ? _c : tslib_1.__classPrivateFieldGet(this, _MLCore_ruleset, "f").childNodeRules,
116
116
  }, "f");
117
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_rules, rules !== null && rules !== void 0 ? rules : (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_rules, "f"), "f");
118
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_locale, locale !== null && locale !== void 0 ? locale : (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_locale, "f"), "f");
119
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_schemas, schemas !== null && schemas !== void 0 ? schemas : (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_schemas, "f"), "f");
120
- if (parserOptions && parserOptions.ignoreFrontMatter !== (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ignoreFrontMatter, "f")) {
117
+ tslib_1.__classPrivateFieldSet(this, _MLCore_rules, rules !== null && rules !== void 0 ? rules : tslib_1.__classPrivateFieldGet(this, _MLCore_rules, "f"), "f");
118
+ tslib_1.__classPrivateFieldSet(this, _MLCore_locale, locale !== null && locale !== void 0 ? locale : tslib_1.__classPrivateFieldGet(this, _MLCore_locale, "f"), "f");
119
+ tslib_1.__classPrivateFieldSet(this, _MLCore_schemas, schemas !== null && schemas !== void 0 ? schemas : tslib_1.__classPrivateFieldGet(this, _MLCore_schemas, "f"), "f");
120
+ if (parserOptions && parserOptions.ignoreFrontMatter !== tslib_1.__classPrivateFieldGet(this, _MLCore_ignoreFrontMatter, "f")) {
121
121
  this._parse();
122
122
  }
123
123
  this._createDocument();
124
124
  }
125
125
  _parse() {
126
126
  try {
127
- (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");
127
+ 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");
128
128
  }
129
129
  catch (err) {
130
130
  (0, debug_1.log)('Caught the parse error: %O', err);
131
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_ast, null, "f");
131
+ tslib_1.__classPrivateFieldSet(this, _MLCore_ast, null, "f");
132
132
  if (err instanceof parser_utils_1.ParserError) {
133
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_document, err, "f");
133
+ tslib_1.__classPrivateFieldSet(this, _MLCore_document, err, "f");
134
134
  }
135
135
  else {
136
136
  throw err;
@@ -138,19 +138,19 @@ class MLCore {
138
138
  }
139
139
  }
140
140
  _createDocument() {
141
- if (!(0, tslib_1.__classPrivateFieldGet)(this, _MLCore_ast, "f")) {
141
+ if (!tslib_1.__classPrivateFieldGet(this, _MLCore_ast, "f")) {
142
142
  return;
143
143
  }
144
144
  try {
145
- (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"), {
146
- filename: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_filename, "f"),
147
- tagNameCaseSensitive: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").tagNameCaseSensitive,
148
- endTag: (0, tslib_1.__classPrivateFieldGet)(this, _MLCore_parser, "f").endTag,
145
+ tslib_1.__classPrivateFieldSet(this, _MLCore_document, new ml_dom_1.Document(tslib_1.__classPrivateFieldGet(this, _MLCore_ast, "f"), tslib_1.__classPrivateFieldGet(this, _MLCore_ruleset, "f"), tslib_1.__classPrivateFieldGet(this, _MLCore_schemas, "f"), {
146
+ filename: tslib_1.__classPrivateFieldGet(this, _MLCore_filename, "f"),
147
+ tagNameCaseSensitive: tslib_1.__classPrivateFieldGet(this, _MLCore_parser, "f").tagNameCaseSensitive,
148
+ endTag: tslib_1.__classPrivateFieldGet(this, _MLCore_parser, "f").endTag,
149
149
  }), "f");
150
150
  }
151
151
  catch (err) {
152
152
  if (err instanceof parser_utils_1.ParserError) {
153
- (0, tslib_1.__classPrivateFieldSet)(this, _MLCore_document, err, "f");
153
+ tslib_1.__classPrivateFieldSet(this, _MLCore_document, err, "f");
154
154
  }
155
155
  else {
156
156
  throw err;
@@ -51,7 +51,7 @@ class MLDOMDocument {
51
51
  this.isFragment = ast.isFragment;
52
52
  this.specs = (0, ml_spec_1.getSpec)(schemas);
53
53
  this.endTag = (_a = options === null || options === void 0 ? void 0 : options.endTag) !== null && _a !== void 0 ? _a : 'omittable';
54
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMDocument_filename, options === null || options === void 0 ? void 0 : options.filename, "f");
54
+ tslib_1.__classPrivateFieldSet(this, _MLDOMDocument_filename, options === null || options === void 0 ? void 0 : options.filename, "f");
55
55
  // console.log(ast.nodeList.map((n, i) => `${i}: ${n.uuid} "${n.raw.trim()}"(${n.type})`));
56
56
  this.nodeList = Object.freeze(ast.nodeList.map(astNode => {
57
57
  if (astNode.type === 'endtag') {
@@ -65,7 +65,7 @@ class MLDOMDocument {
65
65
  * It could be used in rule, make sure it is immutable
66
66
  */
67
67
  get filename() {
68
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMDocument_filename, "f");
68
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMDocument_filename, "f");
69
69
  }
70
70
  get doctype() {
71
71
  for (const node of this.nodeList) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.createNode = void 0;
4
4
  const tslib_1 = require("tslib");
5
5
  const tokens_1 = require("../tokens");
6
- const preprocessor_specific_block_1 = (0, tslib_1.__importDefault)(require("../tokens/preprocessor-specific-block"));
6
+ const preprocessor_specific_block_1 = tslib_1.__importDefault(require("../tokens/preprocessor-specific-block"));
7
7
  function createNode(astNode, document, pearNode) {
8
8
  const _astNode = astNode;
9
9
  switch (_astNode.type) {
@@ -56,39 +56,39 @@ class MLDOMIndentation {
56
56
  _MLDOMIndentation_parent.set(this, void 0);
57
57
  _MLDOMIndentation_fixed.set(this, void 0);
58
58
  this.line = line;
59
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMIndentation_node, originTextNode, "f");
60
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMIndentation_parent, parentNode, "f");
61
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMIndentation_fixed, raw, "f");
59
+ tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_node, originTextNode, "f");
60
+ tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_parent, parentNode, "f");
61
+ tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_fixed, raw, "f");
62
62
  }
63
63
  get type() {
64
- if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_parent, "f").type !== 'Text' && this.line !== (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_node, "f").endLine) {
64
+ if (tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").type !== 'Text' && this.line !== tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
65
65
  return 'none';
66
66
  }
67
- const raw = (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_fixed, "f");
67
+ const raw = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
68
68
  return raw === '' ? 'none' : /^\t+$/.test(raw) ? 'tab' : /^[^\t]+$/.test(raw) ? 'space' : 'mixed';
69
69
  }
70
70
  get width() {
71
- if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_parent, "f").type !== 'Text' && this.line !== (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_node, "f").endLine) {
71
+ if (tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").type !== 'Text' && this.line !== tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
72
72
  return 0;
73
73
  }
74
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_fixed, "f").length;
74
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f").length;
75
75
  }
76
76
  get raw() {
77
- if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_parent, "f").type !== 'Text' && this.line !== (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_node, "f").endLine) {
77
+ if (tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_parent, "f").type !== 'Text' && this.line !== tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f").endLine) {
78
78
  return '';
79
79
  }
80
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_fixed, "f");
80
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
81
81
  }
82
82
  fix(raw) {
83
- const current = (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_fixed, "f");
84
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMIndentation_fixed, raw, "f");
85
- if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_node, "f")) {
86
- const node = (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_node, "f");
83
+ const current = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f");
84
+ tslib_1.__classPrivateFieldSet(this, _MLDOMIndentation_fixed, raw, "f");
85
+ if (tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f")) {
86
+ const node = tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_node, "f");
87
87
  const line = node.startLine;
88
88
  const lines = node.raw.split(/\r?\n/);
89
89
  const index = this.line - line;
90
90
  if (lines[index] != null) {
91
- lines[index] = lines[index].replace(current, (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMIndentation_fixed, "f"));
91
+ lines[index] = lines[index].replace(current, tslib_1.__classPrivateFieldGet(this, _MLDOMIndentation_fixed, "f"));
92
92
  }
93
93
  node.fix(lines.join('\n'));
94
94
  }
@@ -8,11 +8,11 @@ class NodeStore {
8
8
  _NodeStore_store.set(this, new Map());
9
9
  }
10
10
  setNode(astNode, node) {
11
- (0, tslib_1.__classPrivateFieldGet)(this, _NodeStore_store, "f").set(astNode.uuid, node);
11
+ tslib_1.__classPrivateFieldGet(this, _NodeStore_store, "f").set(astNode.uuid, node);
12
12
  }
13
13
  getNode(astNode) {
14
14
  // console.log(`Get: ${astNode.uuid} -> ${astNode.raw.trim()}(${astNode.type})`);
15
- const node = (0, tslib_1.__classPrivateFieldGet)(this, _NodeStore_store, "f").get(astNode.uuid);
15
+ const node = tslib_1.__classPrivateFieldGet(this, _NodeStore_store, "f").get(astNode.uuid);
16
16
  if (!node) {
17
17
  throw new parser_utils_1.ParserError('Broke mapping nodes.', {
18
18
  line: astNode.startLine,
@@ -3,7 +3,7 @@ var _Selector_ruleset, _Ruleset_selectorGroup, _StructuredSelector_edge, _Struct
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.compareSpecificity = exports.createSelector = void 0;
5
5
  const tslib_1 = require("tslib");
6
- const postcss_selector_parser_1 = (0, tslib_1.__importDefault)(require("postcss-selector-parser"));
6
+ const postcss_selector_parser_1 = tslib_1.__importDefault(require("postcss-selector-parser"));
7
7
  const debug_1 = require("../../debug");
8
8
  const log = debug_1.log.extend('selector');
9
9
  const resLog = log.extend('result');
@@ -36,10 +36,10 @@ exports.compareSpecificity = compareSpecificity;
36
36
  class Selector {
37
37
  constructor(selector, tagNameCaseSensitive) {
38
38
  _Selector_ruleset.set(this, void 0);
39
- (0, tslib_1.__classPrivateFieldSet)(this, _Selector_ruleset, Ruleset.parse(selector, tagNameCaseSensitive), "f");
39
+ tslib_1.__classPrivateFieldSet(this, _Selector_ruleset, Ruleset.parse(selector, tagNameCaseSensitive), "f");
40
40
  }
41
41
  match(el, caller = el) {
42
- const results = (0, tslib_1.__classPrivateFieldGet)(this, _Selector_ruleset, "f").match(el, caller);
42
+ const results = tslib_1.__classPrivateFieldGet(this, _Selector_ruleset, "f").match(el, caller);
43
43
  for (const result of results) {
44
44
  if (result.matched) {
45
45
  return result.specificity;
@@ -52,7 +52,7 @@ _Selector_ruleset = new WeakMap();
52
52
  class Ruleset {
53
53
  constructor(selectors, tagNameCaseSensitive) {
54
54
  _Ruleset_selectorGroup.set(this, []);
55
- (0, tslib_1.__classPrivateFieldGet)(this, _Ruleset_selectorGroup, "f").push(...selectors.map(selector => new StructuredSelector(selector, tagNameCaseSensitive)));
55
+ tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f").push(...selectors.map(selector => new StructuredSelector(selector, tagNameCaseSensitive)));
56
56
  }
57
57
  static parse(selector, tagNameCaseSensitive) {
58
58
  const selectors = [];
@@ -63,7 +63,7 @@ class Ruleset {
63
63
  }
64
64
  match(el, caller) {
65
65
  log('%s', el.raw);
66
- return (0, tslib_1.__classPrivateFieldGet)(this, _Ruleset_selectorGroup, "f").map(selector => {
66
+ return tslib_1.__classPrivateFieldGet(this, _Ruleset_selectorGroup, "f").map(selector => {
67
67
  const res = selector.match(el, caller);
68
68
  resLog('%s => %o', selector.selector, res);
69
69
  return res;
@@ -75,14 +75,14 @@ class StructuredSelector {
75
75
  constructor(selector, tagNameCaseSensitive) {
76
76
  _StructuredSelector_edge.set(this, void 0);
77
77
  _StructuredSelector_selector.set(this, void 0);
78
- (0, tslib_1.__classPrivateFieldSet)(this, _StructuredSelector_selector, selector, "f");
79
- (0, tslib_1.__classPrivateFieldSet)(this, _StructuredSelector_edge, new SelectorTarget(tagNameCaseSensitive), "f");
80
- (0, tslib_1.__classPrivateFieldGet)(this, _StructuredSelector_selector, "f").nodes.forEach(node => {
78
+ tslib_1.__classPrivateFieldSet(this, _StructuredSelector_selector, selector, "f");
79
+ tslib_1.__classPrivateFieldSet(this, _StructuredSelector_edge, new SelectorTarget(tagNameCaseSensitive), "f");
80
+ tslib_1.__classPrivateFieldGet(this, _StructuredSelector_selector, "f").nodes.forEach(node => {
81
81
  switch (node.type) {
82
82
  case 'combinator': {
83
83
  const combinatedTarget = new SelectorTarget(tagNameCaseSensitive);
84
- combinatedTarget.from((0, tslib_1.__classPrivateFieldGet)(this, _StructuredSelector_edge, "f"), node);
85
- (0, tslib_1.__classPrivateFieldSet)(this, _StructuredSelector_edge, combinatedTarget, "f");
84
+ combinatedTarget.from(tslib_1.__classPrivateFieldGet(this, _StructuredSelector_edge, "f"), node);
85
+ tslib_1.__classPrivateFieldSet(this, _StructuredSelector_edge, combinatedTarget, "f");
86
86
  break;
87
87
  }
88
88
  case 'root':
@@ -96,16 +96,16 @@ class StructuredSelector {
96
96
  throw new Error(`Unsupported comment in selector: ${selector.toString()}`);
97
97
  }
98
98
  default: {
99
- (0, tslib_1.__classPrivateFieldGet)(this, _StructuredSelector_edge, "f").add(node);
99
+ tslib_1.__classPrivateFieldGet(this, _StructuredSelector_edge, "f").add(node);
100
100
  }
101
101
  }
102
102
  });
103
103
  }
104
104
  get selector() {
105
- return (0, tslib_1.__classPrivateFieldGet)(this, _StructuredSelector_selector, "f").nodes.join('');
105
+ return tslib_1.__classPrivateFieldGet(this, _StructuredSelector_selector, "f").nodes.join('');
106
106
  }
107
107
  match(el, caller) {
108
- return (0, tslib_1.__classPrivateFieldGet)(this, _StructuredSelector_edge, "f").match(el, caller);
108
+ return tslib_1.__classPrivateFieldGet(this, _StructuredSelector_edge, "f").match(el, caller);
109
109
  }
110
110
  }
111
111
  _StructuredSelector_edge = new WeakMap(), _StructuredSelector_selector = new WeakMap();
@@ -119,17 +119,17 @@ class SelectorTarget {
119
119
  _SelectorTarget_tagNameCaseSensitive.set(this, void 0);
120
120
  _SelectorTarget_isAdded.set(this, false);
121
121
  _SelectorTarget_combinatedFrom.set(this, null);
122
- (0, tslib_1.__classPrivateFieldSet)(this, _SelectorTarget_tagNameCaseSensitive, tagNameCaseSensitive, "f");
122
+ tslib_1.__classPrivateFieldSet(this, _SelectorTarget_tagNameCaseSensitive, tagNameCaseSensitive, "f");
123
123
  }
124
124
  match(el, caller) {
125
125
  const unitCheck = this._matchWithoutCombinateChecking(el, caller);
126
126
  if (!unitCheck.matched) {
127
127
  return unitCheck;
128
128
  }
129
- if (!(0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_combinatedFrom, "f")) {
129
+ if (!tslib_1.__classPrivateFieldGet(this, _SelectorTarget_combinatedFrom, "f")) {
130
130
  return unitCheck;
131
131
  }
132
- const { target, combinator } = (0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_combinatedFrom, "f");
132
+ const { target, combinator } = tslib_1.__classPrivateFieldGet(this, _SelectorTarget_combinatedFrom, "f");
133
133
  switch (combinator.value) {
134
134
  // Descendant combinator
135
135
  case ' ': {
@@ -247,14 +247,14 @@ class SelectorTarget {
247
247
  throw new Error('Unsupported column combinator yet. If you want it, please request it as the issue (https://github.com/markuplint/markuplint/issues/new).');
248
248
  }
249
249
  default: {
250
- throw new Error(`Unsupported ${(0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_combinatedFrom, "f").combinator.value} combinator in selector`);
250
+ throw new Error(`Unsupported ${tslib_1.__classPrivateFieldGet(this, _SelectorTarget_combinatedFrom, "f").combinator.value} combinator in selector`);
251
251
  }
252
252
  }
253
253
  }
254
254
  _matchWithoutCombinateChecking(el, caller) {
255
255
  const specificity = [0, 0, 0];
256
256
  let matched = true;
257
- if (!(0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_isAdded, "f") && !isScope(el, caller)) {
257
+ if (!tslib_1.__classPrivateFieldGet(this, _SelectorTarget_isAdded, "f") && !isScope(el, caller)) {
258
258
  matched = false;
259
259
  }
260
260
  if (!this.id.every(id => id.value === el.id)) {
@@ -270,7 +270,7 @@ class SelectorTarget {
270
270
  }
271
271
  specificity[1] += this.attr.length;
272
272
  for (const pseudo of this.pseudo) {
273
- const pseudoRes = pseudoMatch(pseudo, el, caller, (0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_tagNameCaseSensitive, "f"));
273
+ const pseudoRes = pseudoMatch(pseudo, el, caller, tslib_1.__classPrivateFieldGet(this, _SelectorTarget_tagNameCaseSensitive, "f"));
274
274
  specificity[0] += pseudoRes.specificity[0];
275
275
  specificity[1] += pseudoRes.specificity[1];
276
276
  specificity[2] += pseudoRes.specificity[2];
@@ -282,7 +282,7 @@ class SelectorTarget {
282
282
  specificity[2] += 1;
283
283
  let a = this.tag.value;
284
284
  let b = el.nodeName;
285
- if (!(0, tslib_1.__classPrivateFieldGet)(this, _SelectorTarget_tagNameCaseSensitive, "f")) {
285
+ if (!tslib_1.__classPrivateFieldGet(this, _SelectorTarget_tagNameCaseSensitive, "f")) {
286
286
  a = a.toLowerCase();
287
287
  b = b.toLowerCase();
288
288
  }
@@ -296,7 +296,7 @@ class SelectorTarget {
296
296
  };
297
297
  }
298
298
  add(selector) {
299
- (0, tslib_1.__classPrivateFieldSet)(this, _SelectorTarget_isAdded, true, "f");
299
+ tslib_1.__classPrivateFieldSet(this, _SelectorTarget_isAdded, true, "f");
300
300
  switch (selector.type) {
301
301
  case 'tag':
302
302
  case 'universal': {
@@ -322,7 +322,7 @@ class SelectorTarget {
322
322
  }
323
323
  }
324
324
  from(target, combinator) {
325
- (0, tslib_1.__classPrivateFieldSet)(this, _SelectorTarget_combinatedFrom, { target, combinator }, "f");
325
+ tslib_1.__classPrivateFieldSet(this, _SelectorTarget_combinatedFrom, { target, combinator }, "f");
326
326
  }
327
327
  }
328
328
  _SelectorTarget_tagNameCaseSensitive = new WeakMap(), _SelectorTarget_isAdded = new WeakMap(), _SelectorTarget_combinatedFrom = new WeakMap();
@@ -12,13 +12,13 @@ class RuleMapper {
12
12
  constructor(nodeList) {
13
13
  _RuleMapper_nodeList.set(this, void 0);
14
14
  _RuleMapper_ruleMap.set(this, new Map());
15
- (0, tslib_1.__classPrivateFieldSet)(this, _RuleMapper_nodeList, nodeList, "f");
15
+ tslib_1.__classPrivateFieldSet(this, _RuleMapper_nodeList, nodeList, "f");
16
16
  }
17
17
  set(node, ruleName, rule) {
18
18
  if (node.type === 'ElementCloseTag') {
19
19
  return;
20
20
  }
21
- const rules = (0, tslib_1.__classPrivateFieldGet)(this, _RuleMapper_ruleMap, "f").get(node.uuid) || {};
21
+ const rules = tslib_1.__classPrivateFieldGet(this, _RuleMapper_ruleMap, "f").get(node.uuid) || {};
22
22
  const currentRule = rules[ruleName];
23
23
  if (currentRule) {
24
24
  const order = (0, selector_1.compareSpecificity)(currentRule.specificity, rule.specificity);
@@ -29,16 +29,16 @@ class RuleMapper {
29
29
  ruleMapperLog('Unset %o from %s', currentRule, node);
30
30
  }
31
31
  rules[ruleName] = rule;
32
- (0, tslib_1.__classPrivateFieldGet)(this, _RuleMapper_ruleMap, "f").set(node.uuid, rules);
32
+ tslib_1.__classPrivateFieldGet(this, _RuleMapper_ruleMap, "f").set(node.uuid, rules);
33
33
  if (node.type === 'Element' && node.closeTag) {
34
- (0, tslib_1.__classPrivateFieldGet)(this, _RuleMapper_ruleMap, "f").set(node.closeTag.uuid, rules);
34
+ tslib_1.__classPrivateFieldGet(this, _RuleMapper_ruleMap, "f").set(node.closeTag.uuid, rules);
35
35
  }
36
36
  ruleMapperLog('Set to %s from %s (%o): %O', node.raw, rule.from, rule.specificity, rule.rule);
37
37
  }
38
38
  apply() {
39
39
  ruleMapperLog('ruleTree:');
40
- (0, tslib_1.__classPrivateFieldGet)(this, _RuleMapper_nodeList, "f").forEach(node => {
41
- const rules = (0, tslib_1.__classPrivateFieldGet)(this, _RuleMapper_ruleMap, "f").get(node.uuid);
40
+ tslib_1.__classPrivateFieldGet(this, _RuleMapper_nodeList, "f").forEach(node => {
41
+ const rules = tslib_1.__classPrivateFieldGet(this, _RuleMapper_ruleMap, "f").get(node.uuid);
42
42
  if (!rules) {
43
43
  return;
44
44
  }
@@ -6,7 +6,7 @@ const ml_spec_1 = require("@markuplint/ml-spec");
6
6
  const helper_1 = require("../helper");
7
7
  const accname_1 = require("../helper/accname");
8
8
  const walkers_1 = require("../helper/walkers");
9
- const node_1 = (0, tslib_1.__importDefault)(require("./node"));
9
+ const node_1 = tslib_1.__importDefault(require("./node"));
10
10
  class MLDOMAbstractElement extends node_1.default {
11
11
  constructor(astNode, document) {
12
12
  super(astNode, document);
@@ -20,7 +20,7 @@ class MLDOMAbstractElement extends node_1.default {
20
20
  _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache.set(this, null);
21
21
  _MLDOMAbstractElement_normalizedString.set(this, null);
22
22
  this.nodeName = astNode.nodeName;
23
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMAbstractElement_fixedNodeName, astNode.nodeName, "f");
23
+ tslib_1.__classPrivateFieldSet(this, _MLDOMAbstractElement_fixedNodeName, astNode.nodeName, "f");
24
24
  this.namespaceURI = astNode.namespace;
25
25
  this.isForeignElement = this.namespaceURI !== 'http://www.w3.org/1999/xhtml';
26
26
  this.isCustomElement = astNode.isCustomElement;
@@ -98,7 +98,7 @@ class MLDOMAbstractElement extends node_1.default {
98
98
  return this.getAttribute('id') || '';
99
99
  }
100
100
  get fixedNodeName() {
101
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_fixedNodeName, "f");
101
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMAbstractElement_fixedNodeName, "f");
102
102
  }
103
103
  get textContent() {
104
104
  return this.childNodes.map(child => child.textContent || '').join('');
@@ -161,11 +161,11 @@ class MLDOMAbstractElement extends node_1.default {
161
161
  return !!(0, helper_1.createSelector)(selector).match(this);
162
162
  }
163
163
  fixNodeName(name) {
164
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMAbstractElement_fixedNodeName, name, "f");
164
+ tslib_1.__classPrivateFieldSet(this, _MLDOMAbstractElement_fixedNodeName, name, "f");
165
165
  }
166
166
  getChildElementsAndTextNodeWithoutWhitespaces() {
167
- if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f")) {
168
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f");
167
+ if (tslib_1.__classPrivateFieldGet(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f")) {
168
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, "f");
169
169
  }
170
170
  const filteredNodes = [];
171
171
  this.childNodes.forEach(node => {
@@ -180,7 +180,7 @@ class MLDOMAbstractElement extends node_1.default {
180
180
  filteredNodes.push(...children);
181
181
  }
182
182
  });
183
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, filteredNodes, "f");
183
+ tslib_1.__classPrivateFieldSet(this, _MLDOMAbstractElement_getChildElementsAndTextNodeWithoutWhitespacesCache, filteredNodes, "f");
184
184
  return filteredNodes;
185
185
  }
186
186
  /**
@@ -230,8 +230,8 @@ class MLDOMAbstractElement extends node_1.default {
230
230
  return (0, accname_1.getAccname)(this);
231
231
  }
232
232
  toNormalizeString() {
233
- if ((0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_normalizedString, "f")) {
234
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMAbstractElement_normalizedString, "f");
233
+ if (tslib_1.__classPrivateFieldGet(this, _MLDOMAbstractElement_normalizedString, "f")) {
234
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMAbstractElement_normalizedString, "f");
235
235
  }
236
236
  const children = this.getChildElementsAndTextNodeWithoutWhitespaces();
237
237
  const attrs = this.attributes.map(attr => attr.toNormalizeString());
@@ -245,7 +245,7 @@ class MLDOMAbstractElement extends node_1.default {
245
245
  });
246
246
  const endTag = `</${this.nodeName}>`;
247
247
  const normalizedString = `${startTag}${childNodes.join('')}${endTag}`;
248
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMAbstractElement_normalizedString, normalizedString, "f");
248
+ tslib_1.__classPrivateFieldSet(this, _MLDOMAbstractElement_normalizedString, normalizedString, "f");
249
249
  return normalizedString;
250
250
  }
251
251
  }
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const token_1 = (0, tslib_1.__importDefault)(require("./token"));
4
+ const token_1 = tslib_1.__importDefault(require("./token"));
5
5
  class MLDOMAttribute extends token_1.default {
6
6
  constructor(astToken) {
7
7
  super(astToken);
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const tslib_1 = require("tslib");
4
- const node_1 = (0, tslib_1.__importDefault)(require("./node"));
4
+ const node_1 = tslib_1.__importDefault(require("./node"));
5
5
  class MLDOMComment extends node_1.default {
6
6
  constructor() {
7
7
  super(...arguments);
@@ -2,7 +2,7 @@
2
2
  var _MLDOMDoctype_name, _MLDOMDoctype_publicId, _MLDOMDoctype_systemId;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
4
  const tslib_1 = require("tslib");
5
- const node_1 = (0, tslib_1.__importDefault)(require("./node"));
5
+ const node_1 = tslib_1.__importDefault(require("./node"));
6
6
  class MLDOMDoctype extends node_1.default {
7
7
  constructor(astNode, document) {
8
8
  super(astNode, document);
@@ -11,18 +11,18 @@ class MLDOMDoctype extends node_1.default {
11
11
  _MLDOMDoctype_name.set(this, void 0);
12
12
  _MLDOMDoctype_publicId.set(this, void 0);
13
13
  _MLDOMDoctype_systemId.set(this, void 0);
14
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMDoctype_name, astNode.name, "f");
15
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMDoctype_publicId, astNode.publicId, "f");
16
- (0, tslib_1.__classPrivateFieldSet)(this, _MLDOMDoctype_systemId, astNode.systemId, "f");
14
+ tslib_1.__classPrivateFieldSet(this, _MLDOMDoctype_name, astNode.name, "f");
15
+ tslib_1.__classPrivateFieldSet(this, _MLDOMDoctype_publicId, astNode.publicId, "f");
16
+ tslib_1.__classPrivateFieldSet(this, _MLDOMDoctype_systemId, astNode.systemId, "f");
17
17
  }
18
18
  get name() {
19
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMDoctype_name, "f");
19
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMDoctype_name, "f");
20
20
  }
21
21
  get publicId() {
22
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMDoctype_publicId, "f");
22
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMDoctype_publicId, "f");
23
23
  }
24
24
  get systemId() {
25
- return (0, tslib_1.__classPrivateFieldGet)(this, _MLDOMDoctype_systemId, "f");
25
+ return tslib_1.__classPrivateFieldGet(this, _MLDOMDoctype_systemId, "f");
26
26
  }
27
27
  get textContent() {
28
28
  return null;