@takazudo/mdx-formatter 1.0.2 → 1.0.3
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/index.d.ts +7 -0
- package/dist/index.js +10 -0
- package/package.json +1 -1
package/dist/index.d.ts
CHANGED
|
@@ -9,6 +9,12 @@ export { detectMdx };
|
|
|
9
9
|
* Format markdown/MDX content using the Rust formatter.
|
|
10
10
|
*/
|
|
11
11
|
export declare function format(content: string, options?: FormatOptions): Promise<string>;
|
|
12
|
+
/**
|
|
13
|
+
* Synchronous format with default settings.
|
|
14
|
+
* API-compatible with @takazudo/mdx-formatter-wasm's format_with_defaults().
|
|
15
|
+
* Useful for mocking the WASM module in Node.js test environments.
|
|
16
|
+
*/
|
|
17
|
+
export declare function formatSync(content: string): string;
|
|
12
18
|
/**
|
|
13
19
|
* Format a file and write it back if changed
|
|
14
20
|
*/
|
|
@@ -19,6 +25,7 @@ export declare function formatFile(filePath: string, options?: FormatOptions): P
|
|
|
19
25
|
export declare function checkFile(filePath: string, options?: FormatOptions): Promise<boolean>;
|
|
20
26
|
declare const _default: {
|
|
21
27
|
format: typeof format;
|
|
28
|
+
formatSync: typeof formatSync;
|
|
22
29
|
formatFile: typeof formatFile;
|
|
23
30
|
checkFile: typeof checkFile;
|
|
24
31
|
detectMdx: typeof detectMdx;
|
package/dist/index.js
CHANGED
|
@@ -6,6 +6,7 @@ import { promises as fs } from 'fs';
|
|
|
6
6
|
import { loadConfig } from './load-config.js';
|
|
7
7
|
import { detectMdx } from './detect-mdx.js';
|
|
8
8
|
import { nativeFormat } from './rust-formatter.js';
|
|
9
|
+
import { formatterSettings } from './settings.js';
|
|
9
10
|
export { detectMdx };
|
|
10
11
|
/**
|
|
11
12
|
* Format markdown/MDX content using the Rust formatter.
|
|
@@ -15,6 +16,14 @@ export async function format(content, options = {}) {
|
|
|
15
16
|
const settingsJson = JSON.stringify(settings);
|
|
16
17
|
return nativeFormat(content, settingsJson);
|
|
17
18
|
}
|
|
19
|
+
/**
|
|
20
|
+
* Synchronous format with default settings.
|
|
21
|
+
* API-compatible with @takazudo/mdx-formatter-wasm's format_with_defaults().
|
|
22
|
+
* Useful for mocking the WASM module in Node.js test environments.
|
|
23
|
+
*/
|
|
24
|
+
export function formatSync(content) {
|
|
25
|
+
return nativeFormat(content, JSON.stringify(formatterSettings));
|
|
26
|
+
}
|
|
18
27
|
/**
|
|
19
28
|
* Format a file and write it back if changed
|
|
20
29
|
*/
|
|
@@ -37,6 +46,7 @@ export async function checkFile(filePath, options = {}) {
|
|
|
37
46
|
}
|
|
38
47
|
export default {
|
|
39
48
|
format,
|
|
49
|
+
formatSync,
|
|
40
50
|
formatFile,
|
|
41
51
|
checkFile,
|
|
42
52
|
detectMdx,
|