@markuplint/file-resolver 3.13.0 → 3.15.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.
@@ -3,6 +3,6 @@ import type { Ruleset, AnyMLRule } from '@markuplint/ml-core';
3
3
  * @deprecated
4
4
  */
5
5
  export declare function autoLoadRules(ruleset: Ruleset): Promise<{
6
- rules: AnyMLRule[];
7
- errors: unknown[];
6
+ rules: AnyMLRule[];
7
+ errors: unknown[];
8
8
  }>;
@@ -3,13 +3,13 @@ import type { ConfigSet } from './types';
3
3
  import type { Config } from '@markuplint/ml-config';
4
4
  import type { Nullable } from '@markuplint/shared';
5
5
  export declare class ConfigProvider {
6
- #private;
7
- resolve(targetFile: Readonly<MLFile>, names: readonly Nullable<string>[], cache?: boolean): Promise<ConfigSet>;
8
- search(targetFile: Readonly<MLFile>): Promise<string | null>;
9
- set(config: Config, key?: string): string;
10
- private _load;
11
- private _mergeConfigs;
12
- private _pathResolve;
13
- private _recursiveLoad;
14
- private _validateConfig;
6
+ #private;
7
+ resolve(targetFile: Readonly<MLFile>, names: readonly Nullable<string>[], cache?: boolean): Promise<ConfigSet>;
8
+ search(targetFile: Readonly<MLFile>): Promise<string | null>;
9
+ set(config: Config, key?: string): string;
10
+ private _load;
11
+ private _mergeConfigs;
12
+ private _pathResolve;
13
+ private _recursiveLoad;
14
+ private _validateConfig;
15
15
  }
@@ -1,11 +1,17 @@
1
1
  import type { LoaderSync } from 'cosmiconfig';
2
2
  type CosmiConfig = ReturnType<LoaderSync>;
3
- export declare function search<T = CosmiConfig>(dir: string, cacheClear: boolean): Promise<{
4
- filePath: string;
5
- config: T;
3
+ export declare function search<T = CosmiConfig>(
4
+ dir: string,
5
+ cacheClear: boolean,
6
+ ): Promise<{
7
+ filePath: string;
8
+ config: T;
6
9
  } | null>;
7
- export declare function load<T = CosmiConfig>(filePath: string, cacheClear: boolean): Promise<{
8
- filePath: string;
9
- config: T;
10
+ export declare function load<T = CosmiConfig>(
11
+ filePath: string,
12
+ cacheClear: boolean,
13
+ ): Promise<{
14
+ filePath: string;
15
+ config: T;
10
16
  } | null>;
11
17
  export {};
@@ -1,24 +1,24 @@
1
1
  import type { Target } from '../types';
2
2
  export declare class MLFile {
3
- #private;
4
- constructor(target: Target);
5
- get dirname(): string;
6
- /**
7
- * Normalized `MLFile.dirname`
8
- */
9
- get nDirname(): string;
10
- /**
11
- * Normalized `MLFile.path`
12
- */
13
- get nPath(): string;
14
- get path(): string;
15
- dirExists(): Promise<boolean>;
16
- getCode(): Promise<string>;
17
- ignored(globPath: string | readonly string[]): boolean;
18
- isExist(): Promise<boolean>;
19
- isFile(): Promise<boolean>;
20
- matches(globPath: string): boolean;
21
- setCode(code: string): void;
22
- private _fetch;
23
- private _stat;
3
+ #private;
4
+ constructor(target: Target);
5
+ get dirname(): string;
6
+ /**
7
+ * Normalized `MLFile.dirname`
8
+ */
9
+ get nDirname(): string;
10
+ /**
11
+ * Normalized `MLFile.path`
12
+ */
13
+ get nPath(): string;
14
+ get path(): string;
15
+ dirExists(): Promise<boolean>;
16
+ getCode(): Promise<string>;
17
+ ignored(globPath: string | readonly string[]): boolean;
18
+ isExist(): Promise<boolean>;
19
+ isFile(): Promise<boolean>;
20
+ matches(globPath: string): boolean;
21
+ setCode(code: string): void;
22
+ private _fetch;
23
+ private _stat;
24
24
  }
@@ -1,9 +1,13 @@
1
1
  import type { MLFile } from './ml-file';
2
2
  import type { MLMarkupLanguageParser, ParserOptions } from '@markuplint/ml-ast';
3
3
  import type { ParserConfig } from '@markuplint/ml-config';
4
- export declare function resolveParser(file: Readonly<MLFile>, parserConfig?: ParserConfig, parserOptions?: ParserOptions): Promise<{
5
- parserModName: string;
6
- parser: MLMarkupLanguageParser;
7
- parserOptions: ParserOptions;
8
- matched: boolean;
4
+ export declare function resolveParser(
5
+ file: Readonly<MLFile>,
6
+ parserConfig?: ParserConfig,
7
+ parserOptions?: ParserOptions,
8
+ ): Promise<{
9
+ parserModName: string;
10
+ parser: MLMarkupLanguageParser;
11
+ parserOptions: ParserOptions;
12
+ matched: boolean;
9
13
  }>;
@@ -1,6 +1,10 @@
1
1
  import type { AnyMLRule, Ruleset, Plugin } from '@markuplint/ml-core';
2
- export declare function resolveRules(plugins: readonly Plugin[], ruleset: Ruleset, importPreset: boolean,
3
- /**
4
- * @deprecated
5
- */
6
- autoLoad: boolean): Promise<Readonly<AnyMLRule>[]>;
2
+ export declare function resolveRules(
3
+ plugins: readonly Plugin[],
4
+ ruleset: Ruleset,
5
+ importPreset: boolean,
6
+ /**
7
+ * @deprecated
8
+ */
9
+ autoLoad: boolean,
10
+ ): Promise<Readonly<AnyMLRule>[]>;
@@ -30,6 +30,9 @@ import type { ExtendedSpec, MLMLSpec } from '@markuplint/ml-spec';
30
30
  * @param specConfig The `spec` property part of the config
31
31
  * @returns
32
32
  */
33
- export declare function resolveSpecs(filePath: string, specConfig?: SpecConfig): Promise<{
34
- schemas: readonly [MLMLSpec, ...ExtendedSpec[]];
33
+ export declare function resolveSpecs(
34
+ filePath: string,
35
+ specConfig?: SpecConfig,
36
+ ): Promise<{
37
+ schemas: readonly [MLMLSpec, ...ExtendedSpec[]];
35
38
  }>;
package/lib/types.d.ts CHANGED
@@ -1,22 +1,24 @@
1
1
  import type { Config } from '@markuplint/ml-config';
2
2
  import type { Plugin } from '@markuplint/ml-core';
3
3
  export interface ConfigSet {
4
- readonly config: Config;
5
- readonly plugins: readonly Plugin[];
6
- readonly files: ReadonlySet<string>;
7
- readonly errs: readonly Readonly<Error>[];
4
+ readonly config: Config;
5
+ readonly plugins: readonly Plugin[];
6
+ readonly files: ReadonlySet<string>;
7
+ readonly errs: readonly Readonly<Error>[];
8
8
  }
9
- export type Target = string | {
10
- /**
11
- * Target source code of evaluation
12
- */
13
- readonly sourceCode: string;
14
- /**
15
- * File names when `sourceCodes`
16
- */
17
- readonly name?: string;
18
- /**
19
- * Workspace path when `sourceCodes`
20
- */
21
- readonly workspace?: string;
22
- };
9
+ export type Target =
10
+ | string
11
+ | {
12
+ /**
13
+ * Target source code of evaluation
14
+ */
15
+ readonly sourceCode: string;
16
+ /**
17
+ * File names when `sourceCodes`
18
+ */
19
+ readonly name?: string;
20
+ /**
21
+ * Workspace path when `sourceCodes`
22
+ */
23
+ readonly workspace?: string;
24
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@markuplint/file-resolver",
3
- "version": "3.13.0",
3
+ "version": "3.15.0",
4
4
  "description": "The file resolver of markuplint",
5
5
  "repository": "git@github.com:markuplint/markuplint.git",
6
6
  "author": "Yusuke Hirao <yusukehirao@me.com>",
@@ -19,24 +19,24 @@
19
19
  "clean": "tsc --build --clean"
20
20
  },
21
21
  "devDependencies": {
22
- "@types/node": "20.6.0"
22
+ "@types/node": "20.10.0"
23
23
  },
24
24
  "dependencies": {
25
- "@markuplint/html-parser": "3.11.0",
25
+ "@markuplint/html-parser": "3.13.0",
26
26
  "@markuplint/ml-ast": "3.2.0",
27
- "@markuplint/ml-config": "3.12.0",
28
- "@markuplint/ml-core": "3.13.0",
29
- "@markuplint/ml-spec": "3.12.0",
30
- "@markuplint/parser-utils": "3.11.0",
31
- "@markuplint/selector": "3.12.0",
27
+ "@markuplint/ml-config": "3.14.0",
28
+ "@markuplint/ml-core": "3.15.0",
29
+ "@markuplint/ml-spec": "3.14.0",
30
+ "@markuplint/parser-utils": "3.13.0",
31
+ "@markuplint/selector": "3.14.0",
32
32
  "@markuplint/shared": "3.8.0",
33
- "cosmiconfig": "^8.3.5",
33
+ "cosmiconfig": "^8.3.6",
34
34
  "cosmiconfig-typescript-loader": "^5.0.0",
35
- "glob": "^10.3.4",
36
- "ignore": "^5.2.4",
35
+ "glob": "^10.3.10",
36
+ "ignore": "^5.3.0",
37
37
  "jsonc": "^2.0.0",
38
38
  "minimatch": "^9.0.3",
39
39
  "tslib": "^2.6.2"
40
40
  },
41
- "gitHead": "ef31aef8f2fff319d0f692feead332ec5fc5c7cf"
41
+ "gitHead": "b37b749d7ac0f9e6cbd022ee7031bc020c6677d3"
42
42
  }