mdat 1.3.4 → 1.3.5

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/dist/api.d.ts DELETED
@@ -1,31 +0,0 @@
1
- import type { VFile } from 'vfile';
2
- import type { ConfigToLoad, RulesToLoad } from './config';
3
- /**
4
- * Expand MDAT comments in one or more Markdown files
5
- * Writing is the responsibility of the caller (e.g. via `await write(result)`)
6
- * @returns an array of VFiles (Even if you only pass a single file path!)
7
- */
8
- export declare function expandFiles(files: string | string[], name?: string, output?: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile[]>;
9
- /**
10
- * Expand MDAT comments in a Markdown string
11
- */
12
- export declare function expandString(markdown: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile>;
13
- /**
14
- * Check and validate MDAT comments in one or more Markdown files
15
- * @returns an array of VFiles (Even if you only pass a single file path!)
16
- */
17
- export declare function checkFiles(files: string | string[], name?: string, output?: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile[]>;
18
- /**
19
- * Check and validate MDAT comments in a Markdown string
20
- */
21
- export declare function checkString(markdown: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile>;
22
- /**
23
- * Collapse MDAT comments in one or more Markdown files
24
- * Writing is the responsibility of the caller (e.g. via `await write(result)`)
25
- * @returns an array of VFiles (Even if you only pass a single file path!)
26
- */
27
- export declare function collapseFiles(files: string | string[], name?: string, output?: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile[]>;
28
- /**
29
- * Collapse MDAT comments in a Markdown string
30
- */
31
- export declare function collapseString(markdown: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile>;
package/dist/config.d.ts DELETED
@@ -1,74 +0,0 @@
1
- import type { NormalizedPackageJson } from 'read-pkg';
2
- import type { Options, Rules } from 'remark-mdat';
3
- import type { Simplify } from 'type-fest';
4
- export type Config = Simplify<Options & {
5
- assetsPath?: string;
6
- packageFile?: string;
7
- }>;
8
- export type ConfigLoaded = {
9
- addMetaComment: boolean | string;
10
- assetsPath: string;
11
- closingPrefix: string;
12
- keywordPrefix: string;
13
- metaCommentIdentifier: string;
14
- packageFile: string | undefined;
15
- rules: Rules;
16
- };
17
- /**
18
- * Generously accept either string paths to .ts, .js, or .json files with
19
- * `Config` type default exports. Takes a single value, or an array of values which
20
- * will be merged right to left.
21
- */
22
- export type ConfigToLoad = Array<Config | string> | Config | string;
23
- /**
24
- * Generously accept either string paths to .ts, .js, or .json files with
25
- * `Rules` type default exports.
26
- */
27
- export type RulesToLoad = Array<Rules | string> | Rules | string;
28
- /**
29
- * Load and validate mdat configuration / rule sets
30
- * Uses cosmiconfig to search in the usual places.
31
- * Merge precedence: Base Defaults < Readme Defaults < Searched Config < Additional Config Paths
32
- *
33
- * Generic to accommodate additional Config options, so set T to your custom config type if needed. You must provide a matching configExtensionSchema as well.
34
- */
35
- export declare function loadConfig(options?: {
36
- /**
37
- * Additional Config objects to merge.
38
- *
39
- * Strings are treated as paths to `ts`, `js`, or `json` files with `Config` type default exports. These will be dynamically loaded by Cosmiconfig.
40
- * Accepts an individual item, or an array. Objects in the array will be merged right to left.
41
- *
42
- */
43
- additionalConfig?: ConfigToLoad;
44
- /**
45
- * Additional Rules objects to merge.
46
- *
47
- * Strings are treated as paths to `ts`, `js`, or `json` files with `Rules` type default exports. These will be dynamically loaded by Cosmiconfig.
48
- * Accepts an individual item, or an array. Objects in the array will be merged right to left, and take precedence over any rules in previously loaded Config objects as well.
49
- */
50
- additionalRules?: RulesToLoad;
51
- /**
52
- * Readme-specific defaults that have higher priority than base defaults but lower than searched config.
53
- * Used internally by loadConfigReadme.
54
- */
55
- readmeDefaults?: Config;
56
- /** Search for config in specific directories, mainly useful for testing. Cosmiconfig default search paths used if unset. */
57
- searchFrom?: string;
58
- }): Promise<ConfigLoaded>;
59
- /**
60
- * Get the current MDAT config object, loading it if necessary
61
- */
62
- export declare function getConfig(): Promise<ConfigLoaded>;
63
- /**
64
- * Convenience function for rules
65
- * Load as package json only as needed, memoize
66
- * Rules could call this themselves, but this is more convenient and efficient
67
- * @throws {Error} If no package.json is found
68
- */
69
- export declare function getPackageJson(): Promise<NormalizedPackageJson>;
70
- /**
71
- * Convenience function for merging configs
72
- * Performs a deep merge, with the rightmost object taking precedence
73
- */
74
- export declare function mergeConfigs(a: Config, b: Config): Config;
package/dist/index.d.ts DELETED
@@ -1,5 +0,0 @@
1
- export { checkFiles, checkString, collapseFiles, collapseString, expandFiles, expandString, } from './api';
2
- export { type Config, loadConfig, mergeConfigs } from './config';
3
- export { checkReadme, checkReadmeFiles, checkReadmeString, collapseReadme, collapseReadmeFiles, expandReadme, expandReadmeFiles, expandReadmeString, } from './readme/api';
4
- export { loadConfigReadme } from './readme/config';
5
- export { type Rules } from 'remark-mdat';