@markuplint/ml-core 4.0.0-alpha.4 → 4.0.0-alpha.6
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.
- package/LICENSE +1 -1
- package/lib/convert-ruleset.d.ts +1 -1
- package/lib/convert-ruleset.js +1 -1
- package/lib/index.d.ts +1 -1
- package/lib/index.js +1 -1
- package/lib/ml-dom/helper/get-indent.js +1 -1
- package/lib/ml-dom/manipulations/child-node-methods.js +1 -1
- package/lib/ml-dom/node/attr.js +2 -2
- package/lib/ml-dom/node/character-data.js +1 -1
- package/lib/ml-dom/node/document-fragment.js +1 -1
- package/lib/ml-dom/node/document.d.ts +1 -1
- package/lib/ml-dom/node/document.js +1 -1
- package/lib/ml-dom/node/dom-token-list.js +2 -2
- package/lib/ml-dom/node/element.js +1 -1
- package/lib/ml-dom/node/named-node-map.js +1 -1
- package/lib/ml-dom/node/node.js +1 -1
- package/lib/ml-dom/node/parent-node.js +1 -1
- package/lib/ml-dom/node/text.js +1 -1
- package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -1
- package/lib/ml-dom/node/unexpected-call-error.js +1 -1
- package/lib/ml-rule/ml-rule.d.ts +1 -1
- package/lib/ruleset/index.d.ts +1 -1
- package/lib/ruleset/index.js +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/utils/get-location-from-chars.js +1 -1
- package/package.json +13 -13
package/LICENSE
CHANGED
package/lib/convert-ruleset.d.ts
CHANGED
package/lib/convert-ruleset.js
CHANGED
package/lib/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { RuleInfo, RuleConfig, RuleConfigValue } from '@markuplint/ml-config';
|
|
2
2
|
export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRole, getImplicitRole, getPermittedRoles, getRoleSpec, getSpec, resolveNamespace, } from '@markuplint/ml-spec';
|
|
3
|
-
export {
|
|
3
|
+
export { Ruleset } from './ruleset/index.js';
|
|
4
4
|
export { enableDebug } from './debug.js';
|
|
5
5
|
export { getIndent } from './ml-dom/helper/get-indent.js';
|
|
6
6
|
export * from './configs.js';
|
package/lib/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { ariaSpecs, contentModelCategoryToTagNames, getAttrSpecs, getComputedRole, getImplicitRole, getPermittedRoles, getRoleSpec, getSpec, resolveNamespace, } from '@markuplint/ml-spec';
|
|
2
|
-
export {
|
|
2
|
+
export { Ruleset } from './ruleset/index.js';
|
|
3
3
|
export { enableDebug } from './debug.js';
|
|
4
4
|
export { getIndent } from './ml-dom/helper/get-indent.js';
|
|
5
5
|
export * from './configs.js';
|
|
@@ -26,7 +26,7 @@ node) {
|
|
|
26
26
|
if (node.isRawTextElementContent()) {
|
|
27
27
|
return null;
|
|
28
28
|
}
|
|
29
|
-
const matched = node.raw.match(/^(\
|
|
29
|
+
const matched = node.raw.match(/^([\t\v\f\r \u00A0\u1680\u2000-\u200A\u2028\u2029\u202F\u205F\u3000\uFEFF]*\n\s*)\S+/);
|
|
30
30
|
if (matched) {
|
|
31
31
|
const spaces = matched[1];
|
|
32
32
|
if (spaces) {
|
package/lib/ml-dom/node/attr.js
CHANGED
|
@@ -14,7 +14,7 @@ import { resolveNamespace } from '@markuplint/ml-spec';
|
|
|
14
14
|
import { MLToken } from '../token/token.js';
|
|
15
15
|
import { MLDomTokenList } from './dom-token-list.js';
|
|
16
16
|
import { MLNode } from './node.js';
|
|
17
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
17
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
18
18
|
export class MLAttr extends MLNode {
|
|
19
19
|
constructor(
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
@@ -54,7 +54,7 @@ export class MLAttr extends MLNode {
|
|
|
54
54
|
this.isDirective = this._astToken.isDirective;
|
|
55
55
|
this.candidate = this._astToken.candidate;
|
|
56
56
|
__classPrivateFieldSet(this, _MLAttr_potentialName, this._astToken.potentialName ?? this.nameNode?.raw ?? '', "f");
|
|
57
|
-
__classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.
|
|
57
|
+
__classPrivateFieldSet(this, _MLAttr_potentialValue, this._astToken.potentialValue ?? this.valueNode?.raw ?? '', "f");
|
|
58
58
|
}
|
|
59
59
|
else {
|
|
60
60
|
this.valueType = this._astToken.valueType;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { after, before, nextElementSibling, previousElementSibling, remove, replaceWith, } from '../manipulations/child-node-methods.js';
|
|
2
2
|
import { MLNode } from './node.js';
|
|
3
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
3
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
4
4
|
export class MLCharacterData extends MLNode {
|
|
5
5
|
/**
|
|
6
6
|
* @implements DOM API: `CharacterData`
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { MLParentNode } from './parent-node.js';
|
|
2
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
2
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
3
3
|
export class MLDocumentFragment extends MLParentNode {
|
|
4
4
|
/**
|
|
5
5
|
* Returns a string appropriate for the type of node as `DocumentFragment`
|
|
@@ -6,7 +6,7 @@ import type { MLNode } from './node.js';
|
|
|
6
6
|
import type { MLText } from './text.js';
|
|
7
7
|
import type { AccessibilityProperties, DocumentNodeType } from './types.js';
|
|
8
8
|
import type { MLRule } from '../../ml-rule/index.js';
|
|
9
|
-
import type Ruleset from '../../ruleset/index.js';
|
|
9
|
+
import type { Ruleset } from '../../ruleset/index.js';
|
|
10
10
|
import type { MLSchema } from '../../types.js';
|
|
11
11
|
import type { Walker } from '../helper/walkers.js';
|
|
12
12
|
import type { MLToken } from '../token/token.js';
|
|
@@ -21,7 +21,7 @@ import { sequentialWalker, syncWalk } from '../helper/walkers.js';
|
|
|
21
21
|
import { nodeListToHTMLCollection } from './node-list.js';
|
|
22
22
|
import { MLParentNode } from './parent-node.js';
|
|
23
23
|
import { RuleMapper } from './rule-mapper.js';
|
|
24
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
24
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
25
25
|
const log = coreLog.extend('ml-dom');
|
|
26
26
|
const docLog = log.extend('document');
|
|
27
27
|
const ruleLog = docLog.extend('rule');
|
|
@@ -11,7 +11,7 @@ var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (
|
|
|
11
11
|
};
|
|
12
12
|
var _MLDomTokenList_origin, _MLDomTokenList_ownerAttrs, _MLDomTokenList_set;
|
|
13
13
|
import { getCol, getLine } from '@markuplint/parser-utils';
|
|
14
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
14
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
15
15
|
export class MLDomTokenList extends Array {
|
|
16
16
|
constructor(tokens,
|
|
17
17
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
@@ -114,7 +114,7 @@ export class MLDomTokenList extends Array {
|
|
|
114
114
|
throw new UnexpectedCallError('Not supported "toggle" method');
|
|
115
115
|
}
|
|
116
116
|
_pick(token, _offset = 0) {
|
|
117
|
-
token = token.trim().split(/\s+/
|
|
117
|
+
token = token.trim().split(/\s+/)[0] ?? '';
|
|
118
118
|
if (!token) {
|
|
119
119
|
return null;
|
|
120
120
|
}
|
|
@@ -22,7 +22,7 @@ import { MLDomTokenList } from './dom-token-list.js';
|
|
|
22
22
|
import { toNamedNodeMap } from './named-node-map.js';
|
|
23
23
|
import { toHTMLCollection } from './node-list.js';
|
|
24
24
|
import { MLParentNode } from './parent-node.js';
|
|
25
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
25
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
26
26
|
const HTML_NAMESPACE = 'http://www.w3.org/1999/xhtml';
|
|
27
27
|
export class MLElement extends MLParentNode {
|
|
28
28
|
constructor(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
1
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
2
2
|
export class MLNamedNodeMap extends Array {
|
|
3
3
|
getNamedItem(qualifiedName) {
|
|
4
4
|
return this.find(attr => attr.name === qualifiedName) ?? null;
|
package/lib/ml-dom/node/node.js
CHANGED
|
@@ -14,7 +14,7 @@ import { MLToken } from '../token/token.js';
|
|
|
14
14
|
import { isChildNode } from './child-node.js';
|
|
15
15
|
import { toNodeList } from './node-list.js';
|
|
16
16
|
import { nodeStore } from './node-store.js';
|
|
17
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
17
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
18
18
|
export class MLNode extends MLToken {
|
|
19
19
|
constructor(astNode,
|
|
20
20
|
// eslint-disable-next-line @typescript-eslint/prefer-readonly-parameter-types
|
|
@@ -14,7 +14,7 @@ import { syncWalk } from '../helper/walkers.js';
|
|
|
14
14
|
import { getChildren } from '../manipulations/get-children.js';
|
|
15
15
|
import { toNodeList } from './node-list.js';
|
|
16
16
|
import { MLNode } from './node.js';
|
|
17
|
-
import UnexpectedCallError from './unexpected-call-error.js';
|
|
17
|
+
import { UnexpectedCallError } from './unexpected-call-error.js';
|
|
18
18
|
/**
|
|
19
19
|
*
|
|
20
20
|
* @see https://dom.spec.whatwg.org/#interface-parentnode
|
package/lib/ml-dom/node/text.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export declare class UnexpectedCallError extends Error {
|
|
2
2
|
}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export
|
|
1
|
+
export class UnexpectedCallError extends Error {
|
|
2
2
|
}
|
package/lib/ml-rule/ml-rule.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { RuleSeed } from './types.js';
|
|
2
2
|
import type { MLDocument } from '../ml-dom/node/document.js';
|
|
3
|
-
import type Ruleset from '../ruleset/index.js';
|
|
3
|
+
import type { Ruleset } from '../ruleset/index.js';
|
|
4
4
|
import type { LocaleSet } from '@markuplint/i18n';
|
|
5
5
|
import type { GlobalRuleInfo, PlainData, Rule, RuleConfigValue, RuleInfo, Severity, Violation } from '@markuplint/ml-config';
|
|
6
6
|
export declare class MLRule<T extends RuleConfigValue, O extends PlainData = undefined> {
|
package/lib/ruleset/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { ChildNodeRule, Config, NodeRule, Rules } from '@markuplint/ml-config';
|
|
2
|
-
export
|
|
2
|
+
export declare class Ruleset {
|
|
3
3
|
readonly childNodeRules: readonly ChildNodeRule[];
|
|
4
4
|
readonly nodeRules: readonly NodeRule[];
|
|
5
5
|
readonly rules: Rules;
|
package/lib/ruleset/index.js
CHANGED
package/lib/types.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import type { AnyMLRule } from './ml-rule/index.js';
|
|
2
|
-
import type Ruleset from './ruleset/index.js';
|
|
2
|
+
import type { Ruleset } from './ruleset/index.js';
|
|
3
3
|
import type { LocaleSet } from '@markuplint/i18n';
|
|
4
4
|
import type { MLMarkupLanguageParser, ParserOptions } from '@markuplint/ml-ast';
|
|
5
5
|
import type { Pretender } from '@markuplint/ml-config';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-core",
|
|
3
|
-
"version": "4.0.0-alpha.
|
|
3
|
+
"version": "4.0.0-alpha.6",
|
|
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>",
|
|
@@ -28,19 +28,19 @@
|
|
|
28
28
|
"./lib/configs.js": "./lib/configs.browser.js"
|
|
29
29
|
},
|
|
30
30
|
"dependencies": {
|
|
31
|
-
"@markuplint/config-presets": "4.0.0-alpha.
|
|
32
|
-
"@markuplint/html-parser": "4.0.0-alpha.
|
|
33
|
-
"@markuplint/html-spec": "4.0.0-alpha.
|
|
34
|
-
"@markuplint/i18n": "4.0.0-alpha.
|
|
35
|
-
"@markuplint/ml-ast": "4.0.0-alpha.
|
|
36
|
-
"@markuplint/ml-config": "4.0.0-alpha.
|
|
37
|
-
"@markuplint/ml-spec": "4.0.0-alpha.
|
|
38
|
-
"@markuplint/parser-utils": "4.0.0-alpha.
|
|
39
|
-
"@markuplint/selector": "4.0.0-alpha.
|
|
40
|
-
"@types/debug": "^4.1.
|
|
31
|
+
"@markuplint/config-presets": "4.0.0-alpha.6",
|
|
32
|
+
"@markuplint/html-parser": "4.0.0-alpha.6",
|
|
33
|
+
"@markuplint/html-spec": "4.0.0-alpha.6",
|
|
34
|
+
"@markuplint/i18n": "4.0.0-alpha.6",
|
|
35
|
+
"@markuplint/ml-ast": "4.0.0-alpha.6",
|
|
36
|
+
"@markuplint/ml-config": "4.0.0-alpha.6",
|
|
37
|
+
"@markuplint/ml-spec": "4.0.0-alpha.6",
|
|
38
|
+
"@markuplint/parser-utils": "4.0.0-alpha.6",
|
|
39
|
+
"@markuplint/selector": "4.0.0-alpha.6",
|
|
40
|
+
"@types/debug": "^4.1.12",
|
|
41
41
|
"debug": "^4.3.4",
|
|
42
42
|
"is-plain-object": "^5.0.0",
|
|
43
|
-
"type-fest": "^4.
|
|
43
|
+
"type-fest": "^4.8.2"
|
|
44
44
|
},
|
|
45
|
-
"gitHead": "
|
|
45
|
+
"gitHead": "06e1242d274c72cf08a10a572b06ac35d1b924a4"
|
|
46
46
|
}
|