@markuplint/ml-core 3.0.0-alpha.4 → 3.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.
Files changed (43) hide show
  1. package/lib/configs.js +5 -1
  2. package/lib/index.d.ts +11 -1
  3. package/lib/ml-core.d.ts +23 -12
  4. package/lib/ml-dom/helper/create-node.d.ts +4 -1
  5. package/lib/ml-dom/helper/getIndent.d.ts +7 -7
  6. package/lib/ml-dom/helper/walkers.d.ts +12 -4
  7. package/lib/ml-dom/index.d.ts +1 -0
  8. package/lib/ml-dom/manipulations/child-node-methods.d.ts +18 -5
  9. package/lib/ml-dom/manipulations/get-children.d.ts +3 -1
  10. package/lib/ml-dom/node/attr.d.ts +89 -89
  11. package/lib/ml-dom/node/block.d.ts +30 -30
  12. package/lib/ml-dom/node/character-data.d.ts +59 -52
  13. package/lib/ml-dom/node/child-node.d.ts +6 -1
  14. package/lib/ml-dom/node/comment.d.ts +15 -12
  15. package/lib/ml-dom/node/document-fragment.d.ts +22 -19
  16. package/lib/ml-dom/node/document-type.d.ts +34 -31
  17. package/lib/ml-dom/node/document.d.ts +1596 -1562
  18. package/lib/ml-dom/node/document.js +31 -0
  19. package/lib/ml-dom/node/dom-token-list.d.ts +27 -27
  20. package/lib/ml-dom/node/element.d.ts +1894 -1840
  21. package/lib/ml-dom/node/element.js +60 -0
  22. package/lib/ml-dom/node/named-node-map.d.ts +44 -39
  23. package/lib/ml-dom/node/node-list.d.ts +9 -3
  24. package/lib/ml-dom/node/node-store.d.ts +3 -3
  25. package/lib/ml-dom/node/node.d.ts +491 -471
  26. package/lib/ml-dom/node/node.js +3 -3
  27. package/lib/ml-dom/node/parent-node.d.ts +66 -57
  28. package/lib/ml-dom/node/rule-mapper.d.ts +9 -9
  29. package/lib/ml-dom/node/text.d.ts +49 -46
  30. package/lib/ml-dom/node/types.d.ts +78 -22
  31. package/lib/ml-dom/node/unexpected-call-error.d.ts +1 -2
  32. package/lib/ml-dom/token/token.d.ts +44 -44
  33. package/lib/ml-rule/create-test-rule.d.ts +5 -3
  34. package/lib/ml-rule/ml-rule-context.d.ts +55 -47
  35. package/lib/ml-rule/ml-rule.d.ts +25 -23
  36. package/lib/ml-rule/types.d.ts +21 -15
  37. package/lib/plugin/types.d.ts +8 -8
  38. package/lib/ruleset/index.d.ts +4 -4
  39. package/lib/test/index.d.ts +20 -8
  40. package/lib/types.d.ts +9 -9
  41. package/lib/utils/get-location-from-chars.d.ts +9 -4
  42. package/package.json +10 -10
  43. package/tsconfig.tsbuildinfo +1 -1
@@ -4,27 +4,29 @@ import type { RuleSeed } from './types';
4
4
  import type { LocaleSet } from '@markuplint/i18n';
5
5
  import type { GlobalRuleInfo, RuleConfig, RuleConfigValue, RuleInfo, Severity, Violation } from '@markuplint/ml-config';
6
6
  export declare class MLRule<T extends RuleConfigValue, O = null> {
7
- #private;
8
- readonly defaultOptions: O;
9
- readonly defaultSeverity: Severity;
10
- readonly defaultValue: T;
11
- readonly name: string;
12
- constructor(o: RuleSeed<T, O> & {
13
- name: string;
14
- });
15
- /**
16
- * The following getter is unused internally,
17
- * only for extending from 3rd party library
18
- */
19
- protected get f(): RuleSeed<T, O>['fix'];
20
- /**
21
- * The following getter is unused internally,
22
- * only for extending from 3rd party library
23
- */
24
- protected get v(): RuleSeed<T, O>['verify'];
25
- getRuleInfo(ruleSet: Ruleset, ruleName: string): GlobalRuleInfo<T, O>;
26
- optimizeOption(configSettings: T | RuleConfig<T, O> | undefined): RuleInfo<T, O>;
27
- verify(document: MLDocument<T, O>, locale: LocaleSet, fix: boolean): Promise<Violation[]>;
28
- private _optimize;
7
+ #private;
8
+ readonly defaultOptions: O;
9
+ readonly defaultSeverity: Severity;
10
+ readonly defaultValue: T;
11
+ readonly name: string;
12
+ constructor(
13
+ o: RuleSeed<T, O> & {
14
+ name: string;
15
+ },
16
+ );
17
+ /**
18
+ * The following getter is unused internally,
19
+ * only for extending from 3rd party library
20
+ */
21
+ protected get f(): RuleSeed<T, O>['fix'];
22
+ /**
23
+ * The following getter is unused internally,
24
+ * only for extending from 3rd party library
25
+ */
26
+ protected get v(): RuleSeed<T, O>['verify'];
27
+ getRuleInfo(ruleSet: Ruleset, ruleName: string): GlobalRuleInfo<T, O>;
28
+ optimizeOption(configSettings: T | RuleConfig<T, O> | undefined): RuleInfo<T, O>;
29
+ verify(document: MLDocument<T, O>, locale: LocaleSet, fix: boolean): Promise<Violation[]>;
30
+ private _optimize;
29
31
  }
30
- export declare type AnyMLRule = MLRule<RuleConfigValue, unknown>;
32
+ export type AnyMLRule = MLRule<RuleConfigValue, unknown>;
@@ -2,19 +2,25 @@ import type { Attr, Element } from '../ml-dom';
2
2
  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
- export declare type RuleSeed<T extends RuleConfigValue = boolean, O = null> = {
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>;
5
+ export type RuleSeed<T extends RuleConfigValue = boolean, O = null> = {
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 declare type Checker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P) => CheckerReport<T, O>;
13
- export declare type ElementChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
14
- el: Element<T, O>;
15
- }) => CheckerReport<T, O>;
16
- export declare type AttrChecker<T extends RuleConfigValue, O = null, P extends Record<string, unknown> = {}> = (params: P & {
17
- attr: Attr<T, O>;
18
- }) => CheckerReport<T, O>;
19
- export declare type CheckerReport<T extends RuleConfigValue, O = null> = (t: Translator) => Report<T, O> | undefined | null;
20
- export declare type AnyRuleSeed = RuleSeed<any, any>;
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>;
25
+ export type CheckerReport<T extends RuleConfigValue, O = null> = (t: Translator) => Report<T, O> | undefined | null;
26
+ export type AnyRuleSeed = RuleSeed<any, any>;
@@ -1,12 +1,12 @@
1
1
  import type { AnyRuleSeed } from '../ml-rule';
2
2
  import type { Config } from '@markuplint/ml-config';
3
- export declare type Plugin = {
4
- name: string;
5
- rules?: Record<string, AnyRuleSeed>;
6
- configs?: Record<string, Config>;
3
+ export type Plugin = {
4
+ name: string;
5
+ rules?: Record<string, AnyRuleSeed>;
6
+ configs?: Record<string, Config>;
7
7
  };
8
- export declare type PluginCreator<S extends CreatePluginSettings> = {
9
- name: string;
10
- create(setting: S): Omit<Plugin, 'name'>;
8
+ export type PluginCreator<S extends CreatePluginSettings> = {
9
+ name: string;
10
+ create(setting: S): Omit<Plugin, 'name'>;
11
11
  };
12
- export declare type CreatePluginSettings = Record<string, unknown>;
12
+ export type CreatePluginSettings = Record<string, unknown>;
@@ -1,7 +1,7 @@
1
1
  import type { ChildNodeRule, Config, NodeRule, Rules } from '@markuplint/ml-config';
2
2
  export default class Ruleset {
3
- readonly childNodeRules: ReadonlyArray<ChildNodeRule>;
4
- readonly nodeRules: ReadonlyArray<NodeRule>;
5
- readonly rules: Readonly<Rules>;
6
- constructor(config: Config);
3
+ readonly childNodeRules: ReadonlyArray<ChildNodeRule>;
4
+ readonly nodeRules: ReadonlyArray<NodeRule>;
5
+ readonly rules: Readonly<Rules>;
6
+ constructor(config: Config);
7
7
  }
@@ -2,15 +2,27 @@ import type { MLMarkupLanguageParser } from '@markuplint/ml-ast';
2
2
  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
- export declare type CreateTestOptions = {
6
- config?: Config;
7
- parser?: MLMarkupLanguageParser;
8
- specs?: MLMLSpec;
5
+ export type CreateTestOptions = {
6
+ config?: Config;
7
+ parser?: MLMarkupLanguageParser;
8
+ specs?: MLMLSpec;
9
9
  };
10
- export declare function createTestDocument<T extends RuleConfigValue = any, O = any>(sourceCode: string, options?: CreateTestOptions): Document<T, O>;
11
- export declare function createTestNodeList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom/node/node").MLNode<any, any, import("@markuplint/ml-ast").MLASTAbstractNode>[];
12
- export declare function createTestTokenList(sourceCode: string, options?: CreateTestOptions): readonly import("../ml-dom/token/token").MLToken<import("@markuplint/ml-ast").MLToken>[];
13
- export declare function createTestElement(sourceCode: string, options?: CreateTestOptions): import("../ml-dom").Element<any, any>;
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
@@ -4,13 +4,13 @@ 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';
6
6
  import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
7
- export declare type MLSchema = Readonly<[MLMLSpec, ...ExtendedSpec[]]>;
8
- export declare type MLFabric = {
9
- parser: MLMarkupLanguageParser;
10
- ruleset: Partial<Ruleset>;
11
- rules: AnyMLRule[];
12
- locale: LocaleSet;
13
- schemas: MLSchema;
14
- parserOptions: ParserOptions;
15
- pretenders: Pretender[];
7
+ export type MLSchema = Readonly<[MLMLSpec, ...ExtendedSpec[]]>;
8
+ export type MLFabric = {
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
- line: number;
3
- col: number;
4
- raw: string;
2
+ line: number;
3
+ col: number;
4
+ raw: string;
5
5
  }
6
- export declare function getLocationFromChars(searches: string[], text: string, currentLine: number, currentCol: number): Location[];
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.0.0-alpha.4",
3
+ "version": "3.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>",
@@ -17,20 +17,20 @@
17
17
  "clean": "tsc --build --clean"
18
18
  },
19
19
  "dependencies": {
20
- "@markuplint/config-presets": "3.0.0-alpha.4",
21
- "@markuplint/i18n": "3.0.0-alpha.4",
22
- "@markuplint/ml-ast": "3.0.0-alpha.4",
23
- "@markuplint/ml-config": "3.0.0-alpha.4",
24
- "@markuplint/ml-spec": "3.0.0-alpha.4",
25
- "@markuplint/parser-utils": "3.0.0-alpha.4",
26
- "@markuplint/selector": "3.0.0-alpha.4",
20
+ "@markuplint/config-presets": "3.0.0-alpha.6",
21
+ "@markuplint/i18n": "3.0.0-alpha.6",
22
+ "@markuplint/ml-ast": "3.0.0-alpha.6",
23
+ "@markuplint/ml-config": "3.0.0-alpha.6",
24
+ "@markuplint/ml-spec": "3.0.0-alpha.6",
25
+ "@markuplint/parser-utils": "3.0.0-alpha.6",
26
+ "@markuplint/selector": "3.0.0-alpha.6",
27
27
  "debug": "^4.3.4",
28
28
  "postcss-selector-parser": "^6.0.10",
29
29
  "tslib": "^2.4.0"
30
30
  },
31
31
  "devDependencies": {
32
- "@markuplint/html-parser": "3.0.0-alpha.4",
32
+ "@markuplint/html-parser": "3.0.0-alpha.6",
33
33
  "@types/debug": "^4.1.7"
34
34
  },
35
- "gitHead": "04fdbb677c6893de3d16613ddcd112de25dc55db"
35
+ "gitHead": "b185a06d4ea09a1bf32458f7be4abe510eb57b89"
36
36
  }