@markuplint/ml-core 3.2.0 → 3.3.1
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/lib/index.d.ts +11 -1
- package/lib/ml-core.d.ts +22 -11
- package/lib/ml-dom/helper/create-node.d.ts +4 -1
- package/lib/ml-dom/helper/getIndent.d.ts +7 -7
- package/lib/ml-dom/helper/walkers.d.ts +11 -3
- package/lib/ml-dom/helper/walkers.js +19 -15
- package/lib/ml-dom/manipulations/child-node-methods.d.ts +18 -5
- package/lib/ml-dom/manipulations/get-children.d.ts +3 -1
- package/lib/ml-dom/node/attr.d.ts +89 -89
- package/lib/ml-dom/node/block.d.ts +30 -30
- package/lib/ml-dom/node/character-data.d.ts +59 -52
- package/lib/ml-dom/node/child-node.d.ts +6 -1
- package/lib/ml-dom/node/comment.d.ts +15 -12
- package/lib/ml-dom/node/document-fragment.d.ts +22 -19
- package/lib/ml-dom/node/document-type.d.ts +34 -31
- package/lib/ml-dom/node/document.d.ts +1596 -1582
- package/lib/ml-dom/node/dom-token-list.d.ts +26 -26
- package/lib/ml-dom/node/element.d.ts +1894 -1888
- package/lib/ml-dom/node/named-node-map.d.ts +44 -39
- package/lib/ml-dom/node/node-list.d.ts +9 -3
- package/lib/ml-dom/node/node-store.d.ts +3 -3
- package/lib/ml-dom/node/node.d.ts +491 -471
- package/lib/ml-dom/node/parent-node.d.ts +66 -57
- package/lib/ml-dom/node/rule-mapper.d.ts +7 -7
- package/lib/ml-dom/node/text.d.ts +49 -46
- package/lib/ml-dom/node/types.d.ts +66 -10
- package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
- package/lib/ml-dom/token/token.d.ts +44 -44
- package/lib/ml-rule/create-test-rule.d.ts +5 -3
- package/lib/ml-rule/ml-rule-context.d.ts +55 -47
- package/lib/ml-rule/ml-rule.d.ts +24 -22
- package/lib/ml-rule/types.d.ts +18 -12
- package/lib/plugin/types.d.ts +5 -5
- package/lib/ruleset/index.d.ts +4 -4
- package/lib/test/index.d.ts +19 -7
- package/lib/types.d.ts +7 -7
- package/lib/utils/get-location-from-chars.d.ts +9 -4
- package/package.json +15 -10
- package/lib/ml-dom/node/pretender.d.ts +0 -5
- package/lib/ml-dom/node/pretender.js +0 -11
package/lib/ml-rule/types.d.ts
CHANGED
|
@@ -3,18 +3,24 @@ import type { MLRuleContext } from './ml-rule-context';
|
|
|
3
3
|
import type { Translator } from '@markuplint/i18n';
|
|
4
4
|
import type { Report, RuleConfigValue, Severity } from '@markuplint/ml-config';
|
|
5
5
|
export type RuleSeed<T extends RuleConfigValue = boolean, O = null> = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
defaultSeverity?: Severity;
|
|
7
|
+
defaultValue?: T;
|
|
8
|
+
defaultOptions?: O;
|
|
9
|
+
verify(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
|
|
10
|
+
fix?(context: ReturnType<MLRuleContext<T, O>['provide']>): void | Promise<void>;
|
|
11
11
|
};
|
|
12
|
-
export type Checker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
}
|
|
12
|
+
export type Checker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (
|
|
13
|
+
params: P,
|
|
14
|
+
) => CheckerReport<T, O>;
|
|
15
|
+
export type ElementChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (
|
|
16
|
+
params: P & {
|
|
17
|
+
el: Element<T, O>;
|
|
18
|
+
},
|
|
19
|
+
) => CheckerReport<T, O>;
|
|
20
|
+
export type AttrChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (
|
|
21
|
+
params: P & {
|
|
22
|
+
attr: Attr<T, O>;
|
|
23
|
+
},
|
|
24
|
+
) => CheckerReport<T, O>;
|
|
19
25
|
export type CheckerReport<T extends RuleConfigValue, O = null> = (t: Translator) => Report<T, O> | undefined | null;
|
|
20
26
|
export type AnyRuleSeed = RuleSeed<any, any>;
|
package/lib/plugin/types.d.ts
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { AnyRuleSeed } from '../ml-rule';
|
|
2
2
|
import type { Config } from '@markuplint/ml-config';
|
|
3
3
|
export type Plugin = {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
4
|
+
name: string;
|
|
5
|
+
rules?: Record<string, AnyRuleSeed>;
|
|
6
|
+
configs?: Record<string, Config>;
|
|
7
7
|
};
|
|
8
8
|
export type PluginCreator<S extends CreatePluginSettings> = {
|
|
9
|
-
|
|
10
|
-
|
|
9
|
+
name: string;
|
|
10
|
+
create(setting: S): Omit<Plugin, 'name'>;
|
|
11
11
|
};
|
|
12
12
|
export type CreatePluginSettings = Record<string, unknown>;
|
package/lib/ruleset/index.d.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { ChildNodeRule, Config, NodeRule, Rules } from '@markuplint/ml-config';
|
|
2
2
|
export default class Ruleset {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
3
|
+
readonly childNodeRules: ReadonlyArray<ChildNodeRule>;
|
|
4
|
+
readonly nodeRules: ReadonlyArray<NodeRule>;
|
|
5
|
+
readonly rules: Readonly<Rules>;
|
|
6
|
+
constructor(config: Config);
|
|
7
7
|
}
|
package/lib/test/index.d.ts
CHANGED
|
@@ -3,14 +3,26 @@ import type { Config, RuleConfigValue } from '@markuplint/ml-config';
|
|
|
3
3
|
import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
|
|
4
4
|
import { Document } from '../ml-dom';
|
|
5
5
|
export type CreateTestOptions = {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
6
|
+
config?: Config;
|
|
7
|
+
parser?: MLMarkupLanguageParser;
|
|
8
|
+
specs?: MLMLSpec;
|
|
9
9
|
};
|
|
10
|
-
export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
10
|
+
export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(
|
|
11
|
+
sourceCode: string,
|
|
12
|
+
options?: CreateTestOptions,
|
|
13
|
+
): Document<T, O>;
|
|
14
|
+
export declare function createTestNodeList(
|
|
15
|
+
sourceCode: string,
|
|
16
|
+
options?: CreateTestOptions,
|
|
17
|
+
): readonly import('../ml-dom/node/node').MLNode<any, any, import('@markuplint/ml-ast').MLASTAbstractNode>[];
|
|
18
|
+
export declare function createTestTokenList(
|
|
19
|
+
sourceCode: string,
|
|
20
|
+
options?: CreateTestOptions,
|
|
21
|
+
): readonly import('../ml-dom/token/token').MLToken<import('@markuplint/ml-ast').MLToken>[];
|
|
22
|
+
export declare function createTestElement(
|
|
23
|
+
sourceCode: string,
|
|
24
|
+
options?: CreateTestOptions,
|
|
25
|
+
): import('../ml-dom').Element<any, any>;
|
|
14
26
|
/**
|
|
15
27
|
* for test suite
|
|
16
28
|
*/
|
package/lib/types.d.ts
CHANGED
|
@@ -6,11 +6,11 @@ import type { Pretender } from '@markuplint/ml-config';
|
|
|
6
6
|
import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
|
|
7
7
|
export type MLSchema = Readonly<[MLMLSpec, ...ExtendedSpec[]]>;
|
|
8
8
|
export type MLFabric = {
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
9
|
+
parser: MLMarkupLanguageParser;
|
|
10
|
+
ruleset: Partial<Ruleset>;
|
|
11
|
+
rules: AnyMLRule[];
|
|
12
|
+
locale: LocaleSet;
|
|
13
|
+
schemas: MLSchema;
|
|
14
|
+
parserOptions: ParserOptions;
|
|
15
|
+
pretenders: Pretender[];
|
|
16
16
|
};
|
|
@@ -1,7 +1,12 @@
|
|
|
1
1
|
interface Location {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
2
|
+
line: number;
|
|
3
|
+
col: number;
|
|
4
|
+
raw: string;
|
|
5
5
|
}
|
|
6
|
-
export declare function getLocationFromChars(
|
|
6
|
+
export declare function getLocationFromChars(
|
|
7
|
+
searches: string[],
|
|
8
|
+
text: string,
|
|
9
|
+
currentLine: number,
|
|
10
|
+
currentCol: number,
|
|
11
|
+
): Location[];
|
|
7
12
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@markuplint/ml-core",
|
|
3
|
-
"version": "3.
|
|
3
|
+
"version": "3.3.1",
|
|
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>",
|
|
@@ -11,6 +11,9 @@
|
|
|
11
11
|
"publishConfig": {
|
|
12
12
|
"access": "public"
|
|
13
13
|
},
|
|
14
|
+
"typedoc": {
|
|
15
|
+
"entryPoint": "./src/index.ts"
|
|
16
|
+
},
|
|
14
17
|
"scripts": {
|
|
15
18
|
"build": "tsc",
|
|
16
19
|
"dev": "tsc --build --watch",
|
|
@@ -20,19 +23,21 @@
|
|
|
20
23
|
"./lib/configs.js": "./lib/configs.browser.js"
|
|
21
24
|
},
|
|
22
25
|
"dependencies": {
|
|
23
|
-
"@markuplint/config-presets": "3.
|
|
24
|
-
"@markuplint/
|
|
25
|
-
"@markuplint/
|
|
26
|
-
"@markuplint/
|
|
27
|
-
"@markuplint/ml-
|
|
28
|
-
"@markuplint/
|
|
29
|
-
"@markuplint/
|
|
26
|
+
"@markuplint/config-presets": "3.3.0",
|
|
27
|
+
"@markuplint/html-parser": "3.3.1",
|
|
28
|
+
"@markuplint/html-spec": "3.3.1",
|
|
29
|
+
"@markuplint/i18n": "3.3.0",
|
|
30
|
+
"@markuplint/ml-ast": "3.0.0",
|
|
31
|
+
"@markuplint/ml-config": "3.3.0",
|
|
32
|
+
"@markuplint/ml-spec": "3.3.0",
|
|
33
|
+
"@markuplint/parser-utils": "3.3.0",
|
|
34
|
+
"@markuplint/selector": "3.3.0",
|
|
30
35
|
"debug": "^4.3.4",
|
|
31
36
|
"tslib": "^2.4.1"
|
|
32
37
|
},
|
|
33
38
|
"devDependencies": {
|
|
34
|
-
"@markuplint/html-parser": "3.
|
|
39
|
+
"@markuplint/html-parser": "3.3.0",
|
|
35
40
|
"@types/debug": "^4.1.7"
|
|
36
41
|
},
|
|
37
|
-
"gitHead": "
|
|
42
|
+
"gitHead": "f19e7de726cf01d53342bc5513c30da75d28da63"
|
|
38
43
|
}
|
|
@@ -1,11 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Pretender = void 0;
|
|
4
|
-
const element_1 = require("./element");
|
|
5
|
-
class Pretender extends element_1.MLElement {
|
|
6
|
-
constructor() {
|
|
7
|
-
super(...arguments);
|
|
8
|
-
this.pretenderContext = null;
|
|
9
|
-
}
|
|
10
|
-
}
|
|
11
|
-
exports.Pretender = Pretender;
|