@markuplint/ml-core 3.9.0 → 3.11.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.
Files changed (44) hide show
  1. package/lib/index.d.ts +1 -11
  2. package/lib/ml-core.d.ts +11 -22
  3. package/lib/ml-dom/helper/create-node.d.ts +1 -5
  4. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  5. package/lib/ml-dom/helper/walkers.d.ts +4 -14
  6. package/lib/ml-dom/manipulations/child-node-methods.d.ts +5 -18
  7. package/lib/ml-dom/manipulations/get-children.d.ts +1 -3
  8. package/lib/ml-dom/node/attr.d.ts +90 -93
  9. package/lib/ml-dom/node/block.d.ts +31 -35
  10. package/lib/ml-dom/node/character-data.d.ts +52 -59
  11. package/lib/ml-dom/node/child-node.d.ts +2 -9
  12. package/lib/ml-dom/node/comment.d.ts +12 -15
  13. package/lib/ml-dom/node/document-fragment.d.ts +19 -22
  14. package/lib/ml-dom/node/document-type.d.ts +31 -34
  15. package/lib/ml-dom/node/document.d.ts +1583 -1600
  16. package/lib/ml-dom/node/document.js +12 -1
  17. package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
  18. package/lib/ml-dom/node/element.d.ts +1904 -1902
  19. package/lib/ml-dom/node/element.js +17 -1
  20. package/lib/ml-dom/node/named-node-map.d.ts +39 -44
  21. package/lib/ml-dom/node/node-list.d.ts +3 -9
  22. package/lib/ml-dom/node/node-store.d.ts +3 -8
  23. package/lib/ml-dom/node/node-store.js +1 -1
  24. package/lib/ml-dom/node/node.d.ts +471 -491
  25. package/lib/ml-dom/node/parent-node.d.ts +57 -66
  26. package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
  27. package/lib/ml-dom/node/text.d.ts +46 -49
  28. package/lib/ml-dom/node/types.d.ts +12 -80
  29. package/lib/ml-dom/node/unexpected-call-error.d.ts +2 -1
  30. package/lib/ml-dom/token/token.d.ts +44 -44
  31. package/lib/ml-rule/create-rule.d.ts +1 -3
  32. package/lib/ml-rule/create-test-rule.d.ts +3 -5
  33. package/lib/ml-rule/ml-rule-context.d.ts +47 -55
  34. package/lib/ml-rule/ml-rule.d.ts +23 -33
  35. package/lib/ml-rule/ml-rule.js +5 -1
  36. package/lib/ml-rule/types.d.ts +13 -31
  37. package/lib/plugin/plugin.d.ts +1 -3
  38. package/lib/plugin/types.d.ts +5 -5
  39. package/lib/ruleset/index.d.ts +4 -4
  40. package/lib/test/index.d.ts +7 -19
  41. package/lib/types.d.ts +8 -8
  42. package/lib/utils/get-location-from-chars.d.ts +4 -9
  43. package/package.json +14 -14
  44. package/test/ml-dom/ml-rule/create-rule.spec.js +108 -0
@@ -5,6 +5,7 @@ exports.MLDocument = void 0;
5
5
  const tslib_1 = require("tslib");
6
6
  const ml_config_1 = require("@markuplint/ml-config");
7
7
  const ml_spec_1 = require("@markuplint/ml-spec");
8
+ const parser_utils_1 = require("@markuplint/parser-utils");
8
9
  const selector_1 = require("@markuplint/selector");
9
10
  const debug_1 = require("../../debug");
10
11
  const create_node_1 = require("../helper/create-node");
@@ -53,7 +54,17 @@ class MLDocument extends parent_node_1.MLParentNode {
53
54
  })
54
55
  .filter((n) => !!n));
55
56
  this._pretending(options === null || options === void 0 ? void 0 : options.pretenders);
56
- this._ruleMapping(ruleset);
57
+ try {
58
+ this._ruleMapping(ruleset);
59
+ }
60
+ catch (error) {
61
+ if (error instanceof selector_1.InvalidSelectorError) {
62
+ throw new parser_utils_1.ConfigParserError(error.message, {
63
+ filePath: 'the configuration',
64
+ });
65
+ }
66
+ throw error;
67
+ }
57
68
  }
58
69
  /**
59
70
  * **IT THROWS AN ERROR WHEN CALLING THIS.**
@@ -1,33 +1,33 @@
1
1
  import type { MLAttr } from './attr';
2
2
  import type { RuleInfo } from '@markuplint/ml-config';
3
3
  type Scope = {
4
- raw: string;
5
- startOffset: number;
6
- startLine: number;
7
- startCol: number;
8
- rule: RuleInfo<any, any>;
4
+ raw: string;
5
+ startOffset: number;
6
+ startLine: number;
7
+ startCol: number;
8
+ rule: RuleInfo<any, any>;
9
9
  };
10
10
  export declare class MLDomTokenList extends Array<string> implements DOMTokenList {
11
- #private;
12
- constructor(tokens: string, ownerAttrs: MLAttr<any, any>[]);
13
- get value(): string;
14
- add(...tokens: readonly string[]): void;
15
- /**
16
- * @implements `@markuplint/ml-core` API: `MLDomTokenList`
17
- */
18
- allTokens(): Scope[];
19
- contains(token: string): boolean;
20
- forEach(callbackfn: (value: string, index: number, parent: any) => void, thisArg?: any): void;
21
- item(index: number): string | null;
22
- /**
23
- * @implements `@markuplint/ml-core` API: `MLDomTokenList`
24
- */
25
- pick(token: string): Scope | null;
26
- remove(...tokens: readonly string[]): void;
27
- replace(token: string, newToken: string): boolean;
28
- supports(token: string): boolean;
29
- toString(): string;
30
- toggle(token: string, force?: boolean): boolean;
31
- private _pick;
11
+ #private;
12
+ constructor(tokens: string, ownerAttrs: MLAttr<any, any>[]);
13
+ get value(): string;
14
+ add(...tokens: readonly string[]): void;
15
+ /**
16
+ * @implements `@markuplint/ml-core` API: `MLDomTokenList`
17
+ */
18
+ allTokens(): Scope[];
19
+ contains(token: string): boolean;
20
+ forEach(callbackfn: (value: string, index: number, parent: any) => void, thisArg?: any): void;
21
+ item(index: number): string | null;
22
+ /**
23
+ * @implements `@markuplint/ml-core` API: `MLDomTokenList`
24
+ */
25
+ pick(token: string): Scope | null;
26
+ remove(...tokens: readonly string[]): void;
27
+ replace(token: string, newToken: string): boolean;
28
+ supports(token: string): boolean;
29
+ toString(): string;
30
+ toggle(token: string, force?: boolean): boolean;
31
+ private _pick;
32
32
  }
33
33
  export {};