@markuplint/ml-core 3.0.0 → 3.1.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.
@@ -4,6 +4,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.nodeStore = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const parser_utils_1 = require("@markuplint/parser-utils");
7
+ const debug_1 = require("../../debug");
8
+ const nodeStoreLog = debug_1.log.extend('node-store');
9
+ const nodeStoreError = nodeStoreLog.extend('error');
7
10
  class NodeStore {
8
11
  constructor() {
9
12
  _NodeStore_store.set(this, new Map());
@@ -12,6 +15,8 @@ class NodeStore {
12
15
  // console.log(`Get: ${astNode.uuid} -> ${astNode.raw.trim()}(${astNode.type})`);
13
16
  const node = tslib_1.__classPrivateFieldGet(this, _NodeStore_store, "f").get(astNode.uuid);
14
17
  if (!node) {
18
+ nodeStoreError('Ref ID: %s (%s: "%s")', astNode.uuid, astNode.nodeName, astNode.raw);
19
+ nodeStoreError('Map: %O', tslib_1.__classPrivateFieldGet(this, _NodeStore_store, "f"));
15
20
  throw new parser_utils_1.ParserError('Broke mapping nodes.', {
16
21
  line: astNode.startLine,
17
22
  col: astNode.startCol,
@@ -22,6 +27,14 @@ class NodeStore {
22
27
  return node;
23
28
  }
24
29
  setNode(astNode, node) {
30
+ if (node.is(node.DOCUMENT_NODE)) {
31
+ return;
32
+ }
33
+ if (!astNode.uuid) {
34
+ nodeStoreError('UUID is invalid: %s (%s: "%s")', astNode.uuid, astNode.nodeName, astNode.raw);
35
+ nodeStoreError('Invalid node: %O', node);
36
+ }
37
+ nodeStoreLog('Mapped: %s (%s: "%s")', astNode.uuid, astNode.nodeName, astNode.raw);
25
38
  tslib_1.__classPrivateFieldGet(this, _NodeStore_store, "f").set(astNode.uuid, node);
26
39
  }
27
40
  }
@@ -14,7 +14,7 @@ class MLRuleContext {
14
14
  get reports() {
15
15
  return tslib_1.__classPrivateFieldGet(this, _MLRuleContext_reports, "f").map(report => ({
16
16
  ...report,
17
- message: finish(report.message),
17
+ message: finish(report.message, this.locale),
18
18
  }));
19
19
  }
20
20
  provide() {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/ml-core",
3
- "version": "3.0.0",
3
+ "version": "3.1.0",
4
4
  "description": "The core module of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -20,19 +20,19 @@
20
20
  "./lib/configs.js": "./lib/configs.browser.js"
21
21
  },
22
22
  "dependencies": {
23
- "@markuplint/config-presets": "3.0.0-rc.5",
23
+ "@markuplint/config-presets": "3.1.0",
24
24
  "@markuplint/i18n": "3.0.0-rc.5",
25
25
  "@markuplint/ml-ast": "3.0.0-rc.5",
26
- "@markuplint/ml-config": "3.0.0",
27
- "@markuplint/ml-spec": "3.0.0",
28
- "@markuplint/parser-utils": "3.0.0",
29
- "@markuplint/selector": "3.0.0",
26
+ "@markuplint/ml-config": "3.1.0",
27
+ "@markuplint/ml-spec": "3.1.0",
28
+ "@markuplint/parser-utils": "3.1.0",
29
+ "@markuplint/selector": "3.1.0",
30
30
  "debug": "^4.3.4",
31
31
  "tslib": "^2.4.1"
32
32
  },
33
33
  "devDependencies": {
34
- "@markuplint/html-parser": "3.0.0",
34
+ "@markuplint/html-parser": "3.1.0",
35
35
  "@types/debug": "^4.1.7"
36
36
  },
37
- "gitHead": "51af6a64bb8da54376a138f19e3f15a2f759a967"
37
+ "gitHead": "0e75df6944f453bc19d2a6e05ad264788a8dc149"
38
38
  }