mdat 0.10.0 → 1.0.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/dist/api.d.ts CHANGED
@@ -1,11 +1,31 @@
1
1
  import { type VFile } from 'vfile';
2
2
  import { type ConfigToLoad, type RulesToLoad } from './config';
3
3
  /**
4
+ * Expand MDAT comments in one or more Markdown files
4
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!)
5
7
  */
6
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
+ */
7
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
+ */
8
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
+ */
9
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
+ */
10
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
+ */
11
31
  export declare function collapseString(markdown: string, config?: ConfigToLoad, rules?: RulesToLoad): Promise<VFile>;
package/dist/config.d.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { type NormalizedPackageJson } from 'read-pkg';
2
2
  import { type Options, type Rules } from 'remark-mdat';
3
3
  import { type Simplify } from 'type-fest';
4
- export type Config = Simplify<{
4
+ export type Config = Simplify<Options & {
5
5
  assetsPath?: string;
6
6
  packageFile?: string;
7
- } & Options>;
7
+ }>;
8
8
  export type ConfigLoaded = {
9
9
  addMetaComment: boolean;
10
10
  assetsPath: string;
@@ -51,7 +51,16 @@ export declare function loadConfig(options?: {
51
51
  /** Search for config in specific directories, mainly useful for testing. Cosmiconfig default search paths used if unset. */
52
52
  searchFrom?: string;
53
53
  }): Promise<ConfigLoaded>;
54
+ /**
55
+ * Get the current MDAT config object, loading it if necessary
56
+ */
54
57
  export declare function getConfig(): Promise<ConfigLoaded>;
58
+ /**
59
+ * Convenience function for rules
60
+ * Load as package json only as needed, memoize
61
+ * Rules could call this themselves, but this is more convenient and efficient
62
+ * @throws If no package.json is found
63
+ */
55
64
  export declare function getPackageJson(): Promise<NormalizedPackageJson>;
56
65
  /**
57
66
  * Convenience function for merging configs
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  export { checkFiles, checkString, collapseFiles, collapseString, expandFiles, expandString, } from './api';
2
2
  export { type Config, loadConfig, mergeConfigs } from './config';
3
- export { checkReadmeFiles, checkReadmeString, collapseReadmeFiles, expandReadmeFiles, expandReadmeString, } from './readme/api';
3
+ export { checkReadme, checkReadmeFiles, checkReadmeString, collapseReadme, collapseReadmeFiles, expandReadme, expandReadmeFiles, expandReadmeString, } from './readme/api';
4
4
  export { loadConfigReadme } from './readme/config';
5
5
  export { type Rules } from 'remark-mdat';