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.
Files changed (66) hide show
  1. package/README.md +3 -0
  2. package/dist/index.d.mts +90 -6
  3. package/dist/index.mjs +2299 -23
  4. package/package.json +1 -1
  5. package/dist/defaults.mjs +0 -19
  6. package/dist/defaults.mjs.map +0 -1
  7. package/dist/engines.d.mts +0 -8
  8. package/dist/engines.mjs +0 -63
  9. package/dist/engines.mjs.map +0 -1
  10. package/dist/excerpt.mjs +0 -26
  11. package/dist/excerpt.mjs.map +0 -1
  12. package/dist/index.mjs.map +0 -1
  13. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_chars.mjs +0 -45
  14. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_chars.mjs.map +0 -1
  15. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_dumper_state.mjs +0 -437
  16. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_dumper_state.mjs.map +0 -1
  17. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_loader_state.mjs +0 -909
  18. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_loader_state.mjs.map +0 -1
  19. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_schema.mjs +0 -115
  20. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_schema.mjs.map +0 -1
  21. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/binary.mjs +0 -89
  22. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/binary.mjs.map +0 -1
  23. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/bool.mjs +0 -35
  24. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/bool.mjs.map +0 -1
  25. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/float.mjs +0 -55
  26. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/float.mjs.map +0 -1
  27. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/int.mjs +0 -114
  28. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/int.mjs.map +0 -1
  29. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/map.mjs +0 -15
  30. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/map.mjs.map +0 -1
  31. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/merge.mjs +0 -11
  32. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/merge.mjs.map +0 -1
  33. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/nil.mjs +0 -20
  34. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/nil.mjs.map +0 -1
  35. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/omap.mjs +0 -28
  36. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/omap.mjs.map +0 -1
  37. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/pairs.mjs +0 -19
  38. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/pairs.mjs.map +0 -1
  39. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/regexp.mjs +0 -26
  40. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/regexp.mjs.map +0 -1
  41. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/seq.mjs +0 -11
  42. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/seq.mjs.map +0 -1
  43. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/set.mjs +0 -14
  44. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/set.mjs.map +0 -1
  45. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/str.mjs +0 -11
  46. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/str.mjs.map +0 -1
  47. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/timestamp.mjs +0 -54
  48. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/timestamp.mjs.map +0 -1
  49. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/undefined.mjs +0 -19
  50. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_type/undefined.mjs.map +0 -1
  51. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_utils.mjs +0 -14
  52. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/_utils.mjs.map +0 -1
  53. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/mod.mjs +0 -4
  54. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/parse.mjs +0 -50
  55. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/parse.mjs.map +0 -1
  56. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/stringify.mjs +0 -32
  57. package/dist/node_modules/.pnpm/@jsr_std__yaml@1.0.10/node_modules/@jsr/std__yaml/stringify.mjs.map +0 -1
  58. package/dist/parse.mjs +0 -13
  59. package/dist/parse.mjs.map +0 -1
  60. package/dist/stringify.mjs +0 -52
  61. package/dist/stringify.mjs.map +0 -1
  62. package/dist/to-file.mjs +0 -44
  63. package/dist/to-file.mjs.map +0 -1
  64. package/dist/types.d.mts +0 -85
  65. package/dist/utils.mjs +0 -60
  66. package/dist/utils.mjs.map +0 -1
package/README.md CHANGED
@@ -1,5 +1,8 @@
1
1
  # gray-matter-es
2
2
 
3
+ [![npm version](https://img.shields.io/npm/v/gray-matter-es?color=yellow)](https://npmjs.com/package/gray-matter-es)
4
+ [![npm downloads](https://img.shields.io/npm/dm/gray-matter-es?color=yellow)](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
- import { Engine, GrayMatterFile, GrayMatterInput, GrayMatterOptions, MatterFunction, ResolvedOptions } from "./types.mjs";
2
- import { BuiltinLanguage } from "./engines.mjs";
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 };