gray-matter-es 0.1.1 → 0.1.2
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/README.md +3 -0
- package/dist/index.d.mts +90 -6
- package/dist/index.mjs +2299 -23
- package/package.json +1 -1
- package/dist/defaults.mjs +0 -19
- package/dist/defaults.mjs.map +0 -1
- package/dist/engines.d.mts +0 -8
- package/dist/engines.mjs +0 -63
- package/dist/engines.mjs.map +0 -1
- package/dist/excerpt.mjs +0 -26
- package/dist/excerpt.mjs.map +0 -1
- package/dist/index.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_chars.mjs +0 -45
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_chars.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_dumper_state.mjs +0 -437
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_dumper_state.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_loader_state.mjs +0 -909
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_loader_state.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_schema.mjs +0 -115
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_schema.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/binary.mjs +0 -89
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/binary.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/bool.mjs +0 -35
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/bool.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/float.mjs +0 -55
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/float.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/int.mjs +0 -114
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/int.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/map.mjs +0 -15
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/map.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/merge.mjs +0 -11
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/merge.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/nil.mjs +0 -20
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/nil.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/omap.mjs +0 -28
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/omap.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/pairs.mjs +0 -19
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/pairs.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/regexp.mjs +0 -26
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/regexp.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/seq.mjs +0 -11
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/seq.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/set.mjs +0 -14
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/set.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/str.mjs +0 -11
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/str.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/timestamp.mjs +0 -54
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/timestamp.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/undefined.mjs +0 -19
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/undefined.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_utils.mjs +0 -14
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_utils.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/mod.mjs +0 -4
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/parse.mjs +0 -50
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/parse.mjs.map +0 -1
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/stringify.mjs +0 -32
- package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/stringify.mjs.map +0 -1
- package/dist/parse.mjs +0 -13
- package/dist/parse.mjs.map +0 -1
- package/dist/stringify.mjs +0 -52
- package/dist/stringify.mjs.map +0 -1
- package/dist/to-file.mjs +0 -44
- package/dist/to-file.mjs.map +0 -1
- package/dist/types.d.mts +0 -85
- package/dist/utils.mjs +0 -60
- package/dist/utils.mjs.map +0 -1
package/README.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# gray-matter-es
|
|
2
2
|
|
|
3
|
+
[](https://npmjs.com/package/gray-matter-es)
|
|
4
|
+
[](https://npmjs.com/package/gray-matter-es)
|
|
5
|
+
|
|
3
6
|
ESM-only [gray-matter](https://github.com/jonschlinkert/gray-matter) implementation.
|
|
4
7
|
|
|
5
8
|
## Features
|
package/dist/index.d.mts
CHANGED
|
@@ -1,12 +1,96 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
1
|
+
//#region src/types.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Engine interface for parsing and stringifying front matter
|
|
4
|
+
*/
|
|
5
|
+
interface Engine {
|
|
6
|
+
parse: (str: string) => Record<string, unknown>;
|
|
7
|
+
stringify?: (data: Record<string, unknown>) => string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* Options for gray-matter
|
|
11
|
+
*/
|
|
12
|
+
interface GrayMatterOptions {
|
|
13
|
+
/** Language to use for parsing (default: 'yaml') */
|
|
14
|
+
language?: "yaml" | "json";
|
|
15
|
+
/** Delimiters for front matter (default: '---') */
|
|
16
|
+
delimiters?: string | [string, string];
|
|
17
|
+
/**
|
|
18
|
+
* Extract an excerpt from the content.
|
|
19
|
+
* - `true`: use the default delimiter
|
|
20
|
+
* - `string`: use this string as the delimiter
|
|
21
|
+
* - `function`: custom excerpt function
|
|
22
|
+
*/
|
|
23
|
+
excerpt?: boolean | string | ((file: GrayMatterFile, options: GrayMatterOptions) => void);
|
|
24
|
+
/** Separator for excerpt in file.data */
|
|
25
|
+
excerpt_separator?: string;
|
|
26
|
+
/** Data to merge with parsed data */
|
|
27
|
+
data?: Record<string, unknown>;
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Resolved options with defaults applied
|
|
31
|
+
*/
|
|
32
|
+
interface ResolvedOptions extends GrayMatterOptions {
|
|
33
|
+
delimiters: [string, string];
|
|
34
|
+
language: "yaml" | "json";
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The file object returned by gray-matter
|
|
38
|
+
*/
|
|
39
|
+
interface GrayMatterFile {
|
|
40
|
+
/** The parsed front matter data */
|
|
41
|
+
data: Record<string, unknown>;
|
|
42
|
+
/** The content after front matter */
|
|
43
|
+
content: string;
|
|
44
|
+
/** The extracted excerpt (if enabled) */
|
|
45
|
+
excerpt: string;
|
|
46
|
+
/** The original input as a Buffer */
|
|
47
|
+
orig: Buffer;
|
|
48
|
+
/** The detected/specified language */
|
|
49
|
+
language: string;
|
|
50
|
+
/** The raw front matter string (without delimiters) */
|
|
51
|
+
matter: string;
|
|
52
|
+
/** True if front matter block was empty */
|
|
53
|
+
isEmpty: boolean;
|
|
54
|
+
/** The original content if isEmpty is true */
|
|
55
|
+
empty?: string;
|
|
56
|
+
/** File path (set by matter.read) */
|
|
57
|
+
path?: string;
|
|
58
|
+
/** Stringify the file back to a string */
|
|
59
|
+
stringify: (data?: Record<string, unknown>, options?: GrayMatterOptions) => string;
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Input that can be passed to gray-matter
|
|
63
|
+
*/
|
|
64
|
+
type GrayMatterInput = string | Buffer | {
|
|
65
|
+
content: string;
|
|
66
|
+
data?: Record<string, unknown>;
|
|
67
|
+
};
|
|
68
|
+
/**
|
|
69
|
+
* The matter function interface with static methods
|
|
70
|
+
*/
|
|
71
|
+
interface MatterFunction {
|
|
72
|
+
(input: GrayMatterInput, options?: GrayMatterOptions): GrayMatterFile;
|
|
73
|
+
stringify: (file: GrayMatterFile | string, data?: Record<string, unknown>, options?: GrayMatterOptions) => string;
|
|
74
|
+
read: (filepath: string, options?: GrayMatterOptions) => GrayMatterFile;
|
|
75
|
+
test: (str: string, options?: GrayMatterOptions) => boolean;
|
|
76
|
+
language: (str: string, options?: GrayMatterOptions) => {
|
|
77
|
+
raw: string;
|
|
78
|
+
name: string;
|
|
79
|
+
};
|
|
80
|
+
clearCache: () => void;
|
|
81
|
+
cache: Map<string, GrayMatterFile>;
|
|
82
|
+
}
|
|
83
|
+
//#endregion
|
|
84
|
+
//#region src/engines.d.ts
|
|
85
|
+
/**
|
|
86
|
+
* Built-in language names
|
|
87
|
+
*/
|
|
88
|
+
type BuiltinLanguage = "yaml" | "json";
|
|
89
|
+
//#endregion
|
|
4
90
|
//#region src/index.d.ts
|
|
5
|
-
|
|
6
91
|
/**
|
|
7
92
|
* The matter function with all static methods
|
|
8
93
|
*/
|
|
9
94
|
declare const matter: MatterFunction;
|
|
10
95
|
//#endregion
|
|
11
|
-
export { type BuiltinLanguage, type Engine, type GrayMatterFile, type GrayMatterInput, type GrayMatterOptions, type MatterFunction, type ResolvedOptions, matter as default, matter };
|
|
12
|
-
//# sourceMappingURL=index.d.mts.map
|
|
96
|
+
export { type BuiltinLanguage, type Engine, type GrayMatterFile, type GrayMatterInput, type GrayMatterOptions, type MatterFunction, type ResolvedOptions, matter as default, matter };
|