@vocasync/astro 0.1.0
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 +580 -0
- package/dist/api/client.d.ts +77 -0
- package/dist/api/client.d.ts.map +1 -0
- package/dist/api/client.js +223 -0
- package/dist/api/client.js.map +1 -0
- package/dist/api/index.d.ts +2 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +2 -0
- package/dist/api/index.js.map +1 -0
- package/dist/cli.d.ts +3 -0
- package/dist/cli.d.ts.map +1 -0
- package/dist/cli.js +257 -0
- package/dist/cli.js.map +1 -0
- package/dist/components/AudioPlayer.astro +1097 -0
- package/dist/components/index.d.ts +19 -0
- package/dist/components/index.d.ts.map +1 -0
- package/dist/components/index.js +4 -0
- package/dist/components/index.js.map +1 -0
- package/dist/config/index.d.ts +3 -0
- package/dist/config/index.d.ts.map +1 -0
- package/dist/config/index.js +2 -0
- package/dist/config/index.js.map +1 -0
- package/dist/config/schema.d.ts +275 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +124 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/core/audio-map.d.ts +52 -0
- package/dist/core/audio-map.d.ts.map +1 -0
- package/dist/core/audio-map.js +97 -0
- package/dist/core/audio-map.js.map +1 -0
- package/dist/core/content-loader.d.ts +17 -0
- package/dist/core/content-loader.d.ts.map +1 -0
- package/dist/core/content-loader.js +141 -0
- package/dist/core/content-loader.js.map +1 -0
- package/dist/core/hash-manager.d.ts +16 -0
- package/dist/core/hash-manager.d.ts.map +1 -0
- package/dist/core/hash-manager.js +21 -0
- package/dist/core/hash-manager.js.map +1 -0
- package/dist/core/index.d.ts +5 -0
- package/dist/core/index.d.ts.map +1 -0
- package/dist/core/index.js +5 -0
- package/dist/core/index.js.map +1 -0
- package/dist/core/speech-builder.d.ts +19 -0
- package/dist/core/speech-builder.d.ts.map +1 -0
- package/dist/core/speech-builder.js +252 -0
- package/dist/core/speech-builder.js.map +1 -0
- package/dist/index.d.ts +34 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +35 -0
- package/dist/index.js.map +1 -0
- package/dist/integration.d.ts +27 -0
- package/dist/integration.d.ts.map +1 -0
- package/dist/integration.js +110 -0
- package/dist/integration.js.map +1 -0
- package/dist/lib/latex-to-speech/index.d.ts +26 -0
- package/dist/lib/latex-to-speech/index.d.ts.map +1 -0
- package/dist/lib/latex-to-speech/index.js +101 -0
- package/dist/lib/latex-to-speech/index.js.map +1 -0
- package/dist/rehype/audio-words.d.ts +50 -0
- package/dist/rehype/audio-words.d.ts.map +1 -0
- package/dist/rehype/audio-words.js +269 -0
- package/dist/rehype/audio-words.js.map +1 -0
- package/dist/rehype/index.d.ts +6 -0
- package/dist/rehype/index.d.ts.map +1 -0
- package/dist/rehype/index.js +4 -0
- package/dist/rehype/index.js.map +1 -0
- package/dist/rehype/rehype-math-speech.d.ts +18 -0
- package/dist/rehype/rehype-math-speech.d.ts.map +1 -0
- package/dist/rehype/rehype-math-speech.js +117 -0
- package/dist/rehype/rehype-math-speech.js.map +1 -0
- package/dist/rehype/remark-math-speech.d.ts +13 -0
- package/dist/rehype/remark-math-speech.d.ts.map +1 -0
- package/dist/rehype/remark-math-speech.js +26 -0
- package/dist/rehype/remark-math-speech.js.map +1 -0
- package/dist/styles/variables.css +181 -0
- package/dist/sync/index.d.ts +3 -0
- package/dist/sync/index.d.ts.map +1 -0
- package/dist/sync/index.js +2 -0
- package/dist/sync/index.js.map +1 -0
- package/dist/sync/orchestrator.d.ts +36 -0
- package/dist/sync/orchestrator.d.ts.map +1 -0
- package/dist/sync/orchestrator.js +166 -0
- package/dist/sync/orchestrator.js.map +1 -0
- package/dist/types/index.d.ts +196 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +2 -0
- package/dist/types/index.js.map +1 -0
- package/package.json +89 -0
- package/src/api/client.ts +316 -0
- package/src/api/index.ts +1 -0
- package/src/cli.ts +301 -0
- package/src/components/AudioPlayer.astro +1097 -0
- package/src/components/index.ts +24 -0
- package/src/config/index.ts +30 -0
- package/src/config/schema.ts +177 -0
- package/src/core/audio-map.ts +107 -0
- package/src/core/content-loader.ts +171 -0
- package/src/core/hash-manager.ts +22 -0
- package/src/core/index.ts +12 -0
- package/src/core/speech-builder.ts +307 -0
- package/src/data/audio-map.example.json +19 -0
- package/src/env.d.ts +13 -0
- package/src/index.ts +67 -0
- package/src/integration.ts +123 -0
- package/src/lib/latex-to-speech/index.ts +126 -0
- package/src/rehype/audio-words.ts +345 -0
- package/src/rehype/index.ts +6 -0
- package/src/rehype/rehype-math-speech.ts +145 -0
- package/src/rehype/remark-math-speech.ts +31 -0
- package/src/styles/variables.css +181 -0
- package/src/sync/index.ts +2 -0
- package/src/sync/orchestrator.ts +239 -0
- package/src/types/index.ts +211 -0
- package/src/types/modules.d.ts +11 -0
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
export interface AudioPlayerProps {
|
|
2
|
+
/** Post slug to lookup audio in audio-map */
|
|
3
|
+
slug: string;
|
|
4
|
+
/** Accessible label for the player */
|
|
5
|
+
label?: string;
|
|
6
|
+
/** Show placeholder when no audio available */
|
|
7
|
+
showPlaceholder?: boolean;
|
|
8
|
+
/** Additional CSS classes */
|
|
9
|
+
class?: string;
|
|
10
|
+
/** Selector for article body (for word highlighting) */
|
|
11
|
+
articleSelector?: string;
|
|
12
|
+
/** Enable floating mini player when main player scrolls out of view */
|
|
13
|
+
enableMiniPlayer?: boolean;
|
|
14
|
+
/** Enable word highlighting during playback */
|
|
15
|
+
enableHighlighting?: boolean;
|
|
16
|
+
/** Number of trailing highlighted words */
|
|
17
|
+
trailLength?: number;
|
|
18
|
+
}
|
|
19
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,gBAAgB;IAC/B,6CAA6C;IAC7C,IAAI,EAAE,MAAM,CAAC;IACb,sCAAsC;IACtC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,+CAA+C;IAC/C,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,6BAA6B;IAC7B,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,wDAAwD;IACxD,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,uEAAuE;IACvE,gBAAgB,CAAC,EAAE,OAAO,CAAC;IAC3B,+CAA+C;IAC/C,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,2CAA2C;IAC3C,WAAW,CAAC,EAAE,MAAM,CAAC;CACtB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/components/index.ts"],"names":[],"mappings":"AAAA,gEAAgE;AAChE,yEAAyE"}
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
export { VocaSyncConfigSchema, CollectionConfigSchema, SynthesisConfigSchema, MathConfigSchema, OutputConfigSchema, ProcessingConfigSchema, VoiceSchema, QualitySchema, FormatSchema, LanguageSchema, MathStyleSchema, validateConfig, defaultConfig, } from "./schema.js";
|
|
2
|
+
export type { VocaSyncConfig, VocaSyncUserConfig, CollectionConfig, SynthesisConfig, MathConfig, OutputConfig, ProcessingConfig, Voice, Quality, Format, Language, MathStyle, } from "./schema.js";
|
|
3
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC;AAErB,YAAY,EACV,cAAc,EACd,kBAAkB,EAClB,gBAAgB,EAChB,eAAe,EACf,UAAU,EACV,YAAY,EACZ,gBAAgB,EAChB,KAAK,EACL,OAAO,EACP,MAAM,EACN,QAAQ,EACR,SAAS,GACV,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
export { VocaSyncConfigSchema, CollectionConfigSchema, SynthesisConfigSchema, MathConfigSchema, OutputConfigSchema, ProcessingConfigSchema, VoiceSchema, QualitySchema, FormatSchema, LanguageSchema, MathStyleSchema, validateConfig, defaultConfig, } from "./schema.js";
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/config/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,oBAAoB,EACpB,sBAAsB,EACtB,qBAAqB,EACrB,gBAAgB,EAChB,kBAAkB,EAClB,sBAAsB,EACtB,WAAW,EACX,aAAa,EACb,YAAY,EACZ,cAAc,EACd,eAAe,EACf,cAAc,EACd,aAAa,GACd,MAAM,aAAa,CAAC"}
|
|
@@ -0,0 +1,275 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Supported TTS voices
|
|
4
|
+
*/
|
|
5
|
+
export declare const VoiceSchema: z.ZodEnum<["alloy", "echo", "fable", "onyx", "nova", "shimmer"]>;
|
|
6
|
+
export type Voice = z.infer<typeof VoiceSchema>;
|
|
7
|
+
/**
|
|
8
|
+
* Supported audio qualities
|
|
9
|
+
*/
|
|
10
|
+
export declare const QualitySchema: z.ZodEnum<["sd", "hd"]>;
|
|
11
|
+
export type Quality = z.infer<typeof QualitySchema>;
|
|
12
|
+
/**
|
|
13
|
+
* Supported audio formats
|
|
14
|
+
*/
|
|
15
|
+
export declare const FormatSchema: z.ZodEnum<["mp3", "opus", "aac", "flac"]>;
|
|
16
|
+
export type Format = z.infer<typeof FormatSchema>;
|
|
17
|
+
/**
|
|
18
|
+
* Supported languages for synthesis
|
|
19
|
+
* Uses short ISO 639-1 codes as expected by the VocaSync API
|
|
20
|
+
*/
|
|
21
|
+
export declare const LanguageSchema: z.ZodEnum<["af", "ar", "hy", "az", "be", "bs", "bg", "ca", "zh", "hr", "cs", "da", "nl", "en", "et", "fi", "fr", "gl", "de", "el", "he", "hi", "hu", "is", "id", "it", "ja", "kn", "kk", "ko", "lv", "lt", "mk", "ms", "mr", "mi", "ne", "no", "fa", "pl", "pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "tl", "ta", "th", "tr", "uk", "ur", "vi", "cy"]>;
|
|
22
|
+
export type Language = z.infer<typeof LanguageSchema>;
|
|
23
|
+
/**
|
|
24
|
+
* Math speech styles
|
|
25
|
+
*/
|
|
26
|
+
export declare const MathStyleSchema: z.ZodEnum<["clearspeak", "mathspeak"]>;
|
|
27
|
+
export type MathStyle = z.infer<typeof MathStyleSchema>;
|
|
28
|
+
/**
|
|
29
|
+
* Collection configuration
|
|
30
|
+
*/
|
|
31
|
+
export declare const CollectionConfigSchema: z.ZodObject<{
|
|
32
|
+
/** Name of the Astro content collection */
|
|
33
|
+
name: z.ZodString;
|
|
34
|
+
/** Path to the content directory */
|
|
35
|
+
path: z.ZodString;
|
|
36
|
+
/** Field used for unique slug identification */
|
|
37
|
+
slugField: z.ZodDefault<z.ZodString>;
|
|
38
|
+
}, "strip", z.ZodTypeAny, {
|
|
39
|
+
path: string;
|
|
40
|
+
name: string;
|
|
41
|
+
slugField: string;
|
|
42
|
+
}, {
|
|
43
|
+
path: string;
|
|
44
|
+
name: string;
|
|
45
|
+
slugField?: string | undefined;
|
|
46
|
+
}>;
|
|
47
|
+
export type CollectionConfig = z.infer<typeof CollectionConfigSchema>;
|
|
48
|
+
/**
|
|
49
|
+
* Synthesis options
|
|
50
|
+
*/
|
|
51
|
+
export declare const SynthesisConfigSchema: z.ZodObject<{
|
|
52
|
+
/** TTS voice to use */
|
|
53
|
+
voice: z.ZodDefault<z.ZodEnum<["alloy", "echo", "fable", "onyx", "nova", "shimmer"]>>;
|
|
54
|
+
/** Audio quality */
|
|
55
|
+
quality: z.ZodDefault<z.ZodEnum<["sd", "hd"]>>;
|
|
56
|
+
/** Output format */
|
|
57
|
+
format: z.ZodDefault<z.ZodEnum<["mp3", "opus", "aac", "flac"]>>;
|
|
58
|
+
}, "strip", z.ZodTypeAny, {
|
|
59
|
+
voice: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer";
|
|
60
|
+
quality: "sd" | "hd";
|
|
61
|
+
format: "mp3" | "opus" | "aac" | "flac";
|
|
62
|
+
}, {
|
|
63
|
+
voice?: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer" | undefined;
|
|
64
|
+
quality?: "sd" | "hd" | undefined;
|
|
65
|
+
format?: "mp3" | "opus" | "aac" | "flac" | undefined;
|
|
66
|
+
}>;
|
|
67
|
+
export type SynthesisConfig = z.infer<typeof SynthesisConfigSchema>;
|
|
68
|
+
/**
|
|
69
|
+
* Math/LaTeX configuration
|
|
70
|
+
*/
|
|
71
|
+
export declare const MathConfigSchema: z.ZodObject<{
|
|
72
|
+
/** Enable LaTeX to speech conversion */
|
|
73
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
74
|
+
/** Speech style for math expressions */
|
|
75
|
+
style: z.ZodDefault<z.ZodEnum<["clearspeak", "mathspeak"]>>;
|
|
76
|
+
}, "strip", z.ZodTypeAny, {
|
|
77
|
+
enabled: boolean;
|
|
78
|
+
style: "clearspeak" | "mathspeak";
|
|
79
|
+
}, {
|
|
80
|
+
enabled?: boolean | undefined;
|
|
81
|
+
style?: "clearspeak" | "mathspeak" | undefined;
|
|
82
|
+
}>;
|
|
83
|
+
export type MathConfig = z.infer<typeof MathConfigSchema>;
|
|
84
|
+
/**
|
|
85
|
+
* Output configuration
|
|
86
|
+
*/
|
|
87
|
+
export declare const OutputConfigSchema: z.ZodObject<{
|
|
88
|
+
/** Path to store the audio-map.json artifact */
|
|
89
|
+
audioMapPath: z.ZodDefault<z.ZodString>;
|
|
90
|
+
}, "strip", z.ZodTypeAny, {
|
|
91
|
+
audioMapPath: string;
|
|
92
|
+
}, {
|
|
93
|
+
audioMapPath?: string | undefined;
|
|
94
|
+
}>;
|
|
95
|
+
export type OutputConfig = z.infer<typeof OutputConfigSchema>;
|
|
96
|
+
/**
|
|
97
|
+
* Processing options
|
|
98
|
+
*/
|
|
99
|
+
export declare const ProcessingConfigSchema: z.ZodObject<{
|
|
100
|
+
/** Number of concurrent synthesis jobs */
|
|
101
|
+
concurrency: z.ZodDefault<z.ZodNumber>;
|
|
102
|
+
/** Force reprocessing even if content hasn't changed */
|
|
103
|
+
force: z.ZodDefault<z.ZodBoolean>;
|
|
104
|
+
}, "strip", z.ZodTypeAny, {
|
|
105
|
+
concurrency: number;
|
|
106
|
+
force: boolean;
|
|
107
|
+
}, {
|
|
108
|
+
concurrency?: number | undefined;
|
|
109
|
+
force?: boolean | undefined;
|
|
110
|
+
}>;
|
|
111
|
+
export type ProcessingConfig = z.infer<typeof ProcessingConfigSchema>;
|
|
112
|
+
/**
|
|
113
|
+
* Main VocaSync configuration schema
|
|
114
|
+
*/
|
|
115
|
+
export declare const VocaSyncConfigSchema: z.ZodObject<{
|
|
116
|
+
/** Content collection settings */
|
|
117
|
+
collection: z.ZodObject<{
|
|
118
|
+
/** Name of the Astro content collection */
|
|
119
|
+
name: z.ZodString;
|
|
120
|
+
/** Path to the content directory */
|
|
121
|
+
path: z.ZodString;
|
|
122
|
+
/** Field used for unique slug identification */
|
|
123
|
+
slugField: z.ZodDefault<z.ZodString>;
|
|
124
|
+
}, "strip", z.ZodTypeAny, {
|
|
125
|
+
path: string;
|
|
126
|
+
name: string;
|
|
127
|
+
slugField: string;
|
|
128
|
+
}, {
|
|
129
|
+
path: string;
|
|
130
|
+
name: string;
|
|
131
|
+
slugField?: string | undefined;
|
|
132
|
+
}>;
|
|
133
|
+
/** Language for synthesis (e.g., "en", "fr", "de") */
|
|
134
|
+
language: z.ZodDefault<z.ZodEnum<["af", "ar", "hy", "az", "be", "bs", "bg", "ca", "zh", "hr", "cs", "da", "nl", "en", "et", "fi", "fr", "gl", "de", "el", "he", "hi", "hu", "is", "id", "it", "ja", "kn", "kk", "ko", "lv", "lt", "mk", "ms", "mr", "mi", "ne", "no", "fa", "pl", "pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "tl", "ta", "th", "tr", "uk", "ur", "vi", "cy"]>>;
|
|
135
|
+
/** Synthesis options */
|
|
136
|
+
synthesis: z.ZodDefault<z.ZodObject<{
|
|
137
|
+
/** TTS voice to use */
|
|
138
|
+
voice: z.ZodDefault<z.ZodEnum<["alloy", "echo", "fable", "onyx", "nova", "shimmer"]>>;
|
|
139
|
+
/** Audio quality */
|
|
140
|
+
quality: z.ZodDefault<z.ZodEnum<["sd", "hd"]>>;
|
|
141
|
+
/** Output format */
|
|
142
|
+
format: z.ZodDefault<z.ZodEnum<["mp3", "opus", "aac", "flac"]>>;
|
|
143
|
+
}, "strip", z.ZodTypeAny, {
|
|
144
|
+
voice: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer";
|
|
145
|
+
quality: "sd" | "hd";
|
|
146
|
+
format: "mp3" | "opus" | "aac" | "flac";
|
|
147
|
+
}, {
|
|
148
|
+
voice?: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer" | undefined;
|
|
149
|
+
quality?: "sd" | "hd" | undefined;
|
|
150
|
+
format?: "mp3" | "opus" | "aac" | "flac" | undefined;
|
|
151
|
+
}>>;
|
|
152
|
+
/** Math/LaTeX support */
|
|
153
|
+
math: z.ZodDefault<z.ZodObject<{
|
|
154
|
+
/** Enable LaTeX to speech conversion */
|
|
155
|
+
enabled: z.ZodDefault<z.ZodBoolean>;
|
|
156
|
+
/** Speech style for math expressions */
|
|
157
|
+
style: z.ZodDefault<z.ZodEnum<["clearspeak", "mathspeak"]>>;
|
|
158
|
+
}, "strip", z.ZodTypeAny, {
|
|
159
|
+
enabled: boolean;
|
|
160
|
+
style: "clearspeak" | "mathspeak";
|
|
161
|
+
}, {
|
|
162
|
+
enabled?: boolean | undefined;
|
|
163
|
+
style?: "clearspeak" | "mathspeak" | undefined;
|
|
164
|
+
}>>;
|
|
165
|
+
/** Output paths */
|
|
166
|
+
output: z.ZodDefault<z.ZodObject<{
|
|
167
|
+
/** Path to store the audio-map.json artifact */
|
|
168
|
+
audioMapPath: z.ZodDefault<z.ZodString>;
|
|
169
|
+
}, "strip", z.ZodTypeAny, {
|
|
170
|
+
audioMapPath: string;
|
|
171
|
+
}, {
|
|
172
|
+
audioMapPath?: string | undefined;
|
|
173
|
+
}>>;
|
|
174
|
+
/** Frontmatter field to check for audio opt-in/out (true/false) */
|
|
175
|
+
frontmatterField: z.ZodOptional<z.ZodString>;
|
|
176
|
+
/** Processing options */
|
|
177
|
+
processing: z.ZodDefault<z.ZodObject<{
|
|
178
|
+
/** Number of concurrent synthesis jobs */
|
|
179
|
+
concurrency: z.ZodDefault<z.ZodNumber>;
|
|
180
|
+
/** Force reprocessing even if content hasn't changed */
|
|
181
|
+
force: z.ZodDefault<z.ZodBoolean>;
|
|
182
|
+
}, "strip", z.ZodTypeAny, {
|
|
183
|
+
concurrency: number;
|
|
184
|
+
force: boolean;
|
|
185
|
+
}, {
|
|
186
|
+
concurrency?: number | undefined;
|
|
187
|
+
force?: boolean | undefined;
|
|
188
|
+
}>>;
|
|
189
|
+
}, "strip", z.ZodTypeAny, {
|
|
190
|
+
collection: {
|
|
191
|
+
path: string;
|
|
192
|
+
name: string;
|
|
193
|
+
slugField: string;
|
|
194
|
+
};
|
|
195
|
+
language: "af" | "ar" | "hy" | "az" | "be" | "bs" | "bg" | "ca" | "zh" | "hr" | "cs" | "da" | "nl" | "en" | "et" | "fi" | "fr" | "gl" | "de" | "el" | "he" | "hi" | "hu" | "is" | "id" | "it" | "ja" | "kn" | "kk" | "ko" | "lv" | "lt" | "mk" | "ms" | "mr" | "mi" | "ne" | "no" | "fa" | "pl" | "pt" | "ro" | "ru" | "sr" | "sk" | "sl" | "es" | "sw" | "sv" | "tl" | "ta" | "th" | "tr" | "uk" | "ur" | "vi" | "cy";
|
|
196
|
+
synthesis: {
|
|
197
|
+
voice: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer";
|
|
198
|
+
quality: "sd" | "hd";
|
|
199
|
+
format: "mp3" | "opus" | "aac" | "flac";
|
|
200
|
+
};
|
|
201
|
+
math: {
|
|
202
|
+
enabled: boolean;
|
|
203
|
+
style: "clearspeak" | "mathspeak";
|
|
204
|
+
};
|
|
205
|
+
output: {
|
|
206
|
+
audioMapPath: string;
|
|
207
|
+
};
|
|
208
|
+
processing: {
|
|
209
|
+
concurrency: number;
|
|
210
|
+
force: boolean;
|
|
211
|
+
};
|
|
212
|
+
frontmatterField?: string | undefined;
|
|
213
|
+
}, {
|
|
214
|
+
collection: {
|
|
215
|
+
path: string;
|
|
216
|
+
name: string;
|
|
217
|
+
slugField?: string | undefined;
|
|
218
|
+
};
|
|
219
|
+
language?: "af" | "ar" | "hy" | "az" | "be" | "bs" | "bg" | "ca" | "zh" | "hr" | "cs" | "da" | "nl" | "en" | "et" | "fi" | "fr" | "gl" | "de" | "el" | "he" | "hi" | "hu" | "is" | "id" | "it" | "ja" | "kn" | "kk" | "ko" | "lv" | "lt" | "mk" | "ms" | "mr" | "mi" | "ne" | "no" | "fa" | "pl" | "pt" | "ro" | "ru" | "sr" | "sk" | "sl" | "es" | "sw" | "sv" | "tl" | "ta" | "th" | "tr" | "uk" | "ur" | "vi" | "cy" | undefined;
|
|
220
|
+
synthesis?: {
|
|
221
|
+
voice?: "alloy" | "echo" | "fable" | "onyx" | "nova" | "shimmer" | undefined;
|
|
222
|
+
quality?: "sd" | "hd" | undefined;
|
|
223
|
+
format?: "mp3" | "opus" | "aac" | "flac" | undefined;
|
|
224
|
+
} | undefined;
|
|
225
|
+
math?: {
|
|
226
|
+
enabled?: boolean | undefined;
|
|
227
|
+
style?: "clearspeak" | "mathspeak" | undefined;
|
|
228
|
+
} | undefined;
|
|
229
|
+
output?: {
|
|
230
|
+
audioMapPath?: string | undefined;
|
|
231
|
+
} | undefined;
|
|
232
|
+
frontmatterField?: string | undefined;
|
|
233
|
+
processing?: {
|
|
234
|
+
concurrency?: number | undefined;
|
|
235
|
+
force?: boolean | undefined;
|
|
236
|
+
} | undefined;
|
|
237
|
+
}>;
|
|
238
|
+
export type VocaSyncConfig = z.infer<typeof VocaSyncConfigSchema>;
|
|
239
|
+
/**
|
|
240
|
+
* User-facing config type (with optional defaults)
|
|
241
|
+
*/
|
|
242
|
+
export type VocaSyncUserConfig = {
|
|
243
|
+
collection: {
|
|
244
|
+
name: string;
|
|
245
|
+
path: string;
|
|
246
|
+
slugField?: string;
|
|
247
|
+
};
|
|
248
|
+
language?: Language;
|
|
249
|
+
synthesis?: {
|
|
250
|
+
voice?: Voice;
|
|
251
|
+
quality?: Quality;
|
|
252
|
+
format?: Format;
|
|
253
|
+
};
|
|
254
|
+
math?: {
|
|
255
|
+
enabled?: boolean;
|
|
256
|
+
style?: MathStyle;
|
|
257
|
+
};
|
|
258
|
+
output?: {
|
|
259
|
+
audioMapPath?: string;
|
|
260
|
+
};
|
|
261
|
+
frontmatterField?: string;
|
|
262
|
+
processing?: {
|
|
263
|
+
concurrency?: number;
|
|
264
|
+
force?: boolean;
|
|
265
|
+
};
|
|
266
|
+
};
|
|
267
|
+
/**
|
|
268
|
+
* Validate and normalize user configuration
|
|
269
|
+
*/
|
|
270
|
+
export declare function validateConfig(userConfig: VocaSyncUserConfig): VocaSyncConfig;
|
|
271
|
+
/**
|
|
272
|
+
* Default configuration values
|
|
273
|
+
*/
|
|
274
|
+
export declare const defaultConfig: Omit<VocaSyncConfig, "collection">;
|
|
275
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAEx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AAE,OAAO,CAAC;QAClB,KAAK,CAAC,EAAE,SAAS,CAAC;KACnB,CAAC;IACF,MAAM,CAAC,EAAE;QACP,YAAY,CAAC,EAAE,MAAM,CAAC;KACvB,CAAC;IACF,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE;QACX,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,KAAK,CAAC,EAAE,OAAO,CAAC;KACjB,CAAC;CACH,CAAC;AAEF;;GAEG;AACH,wBAAgB,cAAc,CAAC,UAAU,EAAE,kBAAkB,GAAG,cAAc,CAE7E;AAED;;GAEG;AACH,eAAO,MAAM,aAAa,EAAE,IAAI,CAAC,cAAc,EAAE,YAAY,CAkB5D,CAAC"}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
import { z } from "zod";
|
|
2
|
+
/**
|
|
3
|
+
* Supported TTS voices
|
|
4
|
+
*/
|
|
5
|
+
export const VoiceSchema = z.enum(["alloy", "echo", "fable", "onyx", "nova", "shimmer"]);
|
|
6
|
+
/**
|
|
7
|
+
* Supported audio qualities
|
|
8
|
+
*/
|
|
9
|
+
export const QualitySchema = z.enum(["sd", "hd"]);
|
|
10
|
+
/**
|
|
11
|
+
* Supported audio formats
|
|
12
|
+
*/
|
|
13
|
+
export const FormatSchema = z.enum(["mp3", "opus", "aac", "flac"]);
|
|
14
|
+
/**
|
|
15
|
+
* Supported languages for synthesis
|
|
16
|
+
* Uses short ISO 639-1 codes as expected by the VocaSync API
|
|
17
|
+
*/
|
|
18
|
+
export const LanguageSchema = z.enum([
|
|
19
|
+
"af", "ar", "hy", "az", "be", "bs", "bg", "ca", "zh", "hr",
|
|
20
|
+
"cs", "da", "nl", "en", "et", "fi", "fr", "gl", "de", "el",
|
|
21
|
+
"he", "hi", "hu", "is", "id", "it", "ja", "kn", "kk", "ko",
|
|
22
|
+
"lv", "lt", "mk", "ms", "mr", "mi", "ne", "no", "fa", "pl",
|
|
23
|
+
"pt", "ro", "ru", "sr", "sk", "sl", "es", "sw", "sv", "tl",
|
|
24
|
+
"ta", "th", "tr", "uk", "ur", "vi", "cy"
|
|
25
|
+
]);
|
|
26
|
+
/**
|
|
27
|
+
* Math speech styles
|
|
28
|
+
*/
|
|
29
|
+
export const MathStyleSchema = z.enum(["clearspeak", "mathspeak"]);
|
|
30
|
+
/**
|
|
31
|
+
* Collection configuration
|
|
32
|
+
*/
|
|
33
|
+
export const CollectionConfigSchema = z.object({
|
|
34
|
+
/** Name of the Astro content collection */
|
|
35
|
+
name: z.string().min(1),
|
|
36
|
+
/** Path to the content directory */
|
|
37
|
+
path: z.string().min(1),
|
|
38
|
+
/** Field used for unique slug identification */
|
|
39
|
+
slugField: z.string().default("slug"),
|
|
40
|
+
});
|
|
41
|
+
/**
|
|
42
|
+
* Synthesis options
|
|
43
|
+
*/
|
|
44
|
+
export const SynthesisConfigSchema = z.object({
|
|
45
|
+
/** TTS voice to use */
|
|
46
|
+
voice: VoiceSchema.default("onyx"),
|
|
47
|
+
/** Audio quality */
|
|
48
|
+
quality: QualitySchema.default("sd"),
|
|
49
|
+
/** Output format */
|
|
50
|
+
format: FormatSchema.default("mp3"),
|
|
51
|
+
});
|
|
52
|
+
/**
|
|
53
|
+
* Math/LaTeX configuration
|
|
54
|
+
*/
|
|
55
|
+
export const MathConfigSchema = z.object({
|
|
56
|
+
/** Enable LaTeX to speech conversion */
|
|
57
|
+
enabled: z.boolean().default(false),
|
|
58
|
+
/** Speech style for math expressions */
|
|
59
|
+
style: MathStyleSchema.default("clearspeak"),
|
|
60
|
+
});
|
|
61
|
+
/**
|
|
62
|
+
* Output configuration
|
|
63
|
+
*/
|
|
64
|
+
export const OutputConfigSchema = z.object({
|
|
65
|
+
/** Path to store the audio-map.json artifact */
|
|
66
|
+
audioMapPath: z.string().default("./src/data/audio-map.json"),
|
|
67
|
+
});
|
|
68
|
+
/**
|
|
69
|
+
* Processing options
|
|
70
|
+
*/
|
|
71
|
+
export const ProcessingConfigSchema = z.object({
|
|
72
|
+
/** Number of concurrent synthesis jobs */
|
|
73
|
+
concurrency: z.number().int().min(1).max(10).default(3),
|
|
74
|
+
/** Force reprocessing even if content hasn't changed */
|
|
75
|
+
force: z.boolean().default(false),
|
|
76
|
+
});
|
|
77
|
+
/**
|
|
78
|
+
* Main VocaSync configuration schema
|
|
79
|
+
*/
|
|
80
|
+
export const VocaSyncConfigSchema = z.object({
|
|
81
|
+
/** Content collection settings */
|
|
82
|
+
collection: CollectionConfigSchema,
|
|
83
|
+
/** Language for synthesis (e.g., "en", "fr", "de") */
|
|
84
|
+
language: LanguageSchema.default("en"),
|
|
85
|
+
/** Synthesis options */
|
|
86
|
+
synthesis: SynthesisConfigSchema.default({}),
|
|
87
|
+
/** Math/LaTeX support */
|
|
88
|
+
math: MathConfigSchema.default({}),
|
|
89
|
+
/** Output paths */
|
|
90
|
+
output: OutputConfigSchema.default({}),
|
|
91
|
+
/** Frontmatter field to check for audio opt-in/out (true/false) */
|
|
92
|
+
frontmatterField: z.string().optional(),
|
|
93
|
+
/** Processing options */
|
|
94
|
+
processing: ProcessingConfigSchema.default({}),
|
|
95
|
+
});
|
|
96
|
+
/**
|
|
97
|
+
* Validate and normalize user configuration
|
|
98
|
+
*/
|
|
99
|
+
export function validateConfig(userConfig) {
|
|
100
|
+
return VocaSyncConfigSchema.parse(userConfig);
|
|
101
|
+
}
|
|
102
|
+
/**
|
|
103
|
+
* Default configuration values
|
|
104
|
+
*/
|
|
105
|
+
export const defaultConfig = {
|
|
106
|
+
language: "en",
|
|
107
|
+
synthesis: {
|
|
108
|
+
voice: "onyx",
|
|
109
|
+
quality: "sd",
|
|
110
|
+
format: "mp3",
|
|
111
|
+
},
|
|
112
|
+
math: {
|
|
113
|
+
enabled: false,
|
|
114
|
+
style: "clearspeak",
|
|
115
|
+
},
|
|
116
|
+
output: {
|
|
117
|
+
audioMapPath: "./src/data/audio-map.json",
|
|
118
|
+
},
|
|
119
|
+
processing: {
|
|
120
|
+
concurrency: 3,
|
|
121
|
+
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GAAuC;IAC/D,QAAQ,EAAE,IAAI;IACd,SAAS,EAAE;QACT,KAAK,EAAE,MAAM;QACb,OAAO,EAAE,IAAI;QACb,MAAM,EAAE,KAAK;KACd;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,KAAK;QACd,KAAK,EAAE,YAAY;KACpB;IACD,MAAM,EAAE;QACN,YAAY,EAAE,2BAA2B;KAC1C;IACD,UAAU,EAAE;QACV,WAAW,EAAE,CAAC;QACd,KAAK,EAAE,KAAK;KACb;CACF,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import type { AudioMap, AudioArtifact } from "../types/index.js";
|
|
2
|
+
/**
|
|
3
|
+
* Create an empty audio map structure
|
|
4
|
+
*/
|
|
5
|
+
export declare function createEmptyAudioMap(): AudioMap;
|
|
6
|
+
/**
|
|
7
|
+
* Load the audio map from disk.
|
|
8
|
+
* Returns an empty map if the file doesn't exist.
|
|
9
|
+
*
|
|
10
|
+
* @param filePath - Path to audio-map.json
|
|
11
|
+
*/
|
|
12
|
+
export declare function loadAudioMap(filePath: string): Promise<AudioMap>;
|
|
13
|
+
/**
|
|
14
|
+
* Save the audio map to disk.
|
|
15
|
+
* Creates parent directories if they don't exist.
|
|
16
|
+
*
|
|
17
|
+
* @param filePath - Path to audio-map.json
|
|
18
|
+
* @param audioMap - The audio map to save
|
|
19
|
+
*/
|
|
20
|
+
export declare function saveAudioMap(filePath: string, audioMap: AudioMap): Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Get an audio entry by slug.
|
|
23
|
+
*
|
|
24
|
+
* @param audioMap - The audio map
|
|
25
|
+
* @param slug - The content slug
|
|
26
|
+
* @returns The audio artifact or undefined
|
|
27
|
+
*/
|
|
28
|
+
export declare function getAudioEntry(audioMap: AudioMap, slug: string): AudioArtifact | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Set an audio entry for a slug.
|
|
31
|
+
*
|
|
32
|
+
* @param audioMap - The audio map to modify
|
|
33
|
+
* @param slug - The content slug
|
|
34
|
+
* @param artifact - The audio artifact
|
|
35
|
+
*/
|
|
36
|
+
export declare function setAudioEntry(audioMap: AudioMap, slug: string, artifact: AudioArtifact): void;
|
|
37
|
+
/**
|
|
38
|
+
* Remove an audio entry by slug.
|
|
39
|
+
*
|
|
40
|
+
* @param audioMap - The audio map to modify
|
|
41
|
+
* @param slug - The content slug
|
|
42
|
+
* @returns True if entry was removed
|
|
43
|
+
*/
|
|
44
|
+
export declare function removeAudioEntry(audioMap: AudioMap, slug: string): boolean;
|
|
45
|
+
/**
|
|
46
|
+
* Get all slugs that have audio entries.
|
|
47
|
+
*
|
|
48
|
+
* @param audioMap - The audio map
|
|
49
|
+
* @returns Array of slugs
|
|
50
|
+
*/
|
|
51
|
+
export declare function getAudioSlugs(audioMap: AudioMap): string[];
|
|
52
|
+
//# sourceMappingURL=audio-map.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-map.d.ts","sourceRoot":"","sources":["../../src/core/audio-map.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAEjE;;GAEG;AACH,wBAAgB,mBAAmB,IAAI,QAAQ,CAM9C;AAED;;;;;GAKG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,QAAQ,CAAC,CAkBtE;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,QAAQ,EAAE,QAAQ,GAAG,OAAO,CAAC,IAAI,CAAC,CAWtF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,aAAa,GAAG,SAAS,CAEzF;AAED;;;;;;GAMG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,EAAE,QAAQ,EAAE,aAAa,GAAG,IAAI,CAE7F;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,QAAQ,EAAE,QAAQ,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,CAM1E;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,EAAE,CAE1D"}
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { readFile, writeFile, mkdir } from "node:fs/promises";
|
|
2
|
+
import { dirname } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Create an empty audio map structure
|
|
5
|
+
*/
|
|
6
|
+
export function createEmptyAudioMap() {
|
|
7
|
+
return {
|
|
8
|
+
version: 1,
|
|
9
|
+
updatedAt: new Date().toISOString(),
|
|
10
|
+
entries: {},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Load the audio map from disk.
|
|
15
|
+
* Returns an empty map if the file doesn't exist.
|
|
16
|
+
*
|
|
17
|
+
* @param filePath - Path to audio-map.json
|
|
18
|
+
*/
|
|
19
|
+
export async function loadAudioMap(filePath) {
|
|
20
|
+
try {
|
|
21
|
+
const content = await readFile(filePath, "utf-8");
|
|
22
|
+
const data = JSON.parse(content);
|
|
23
|
+
// Validate basic structure
|
|
24
|
+
if (typeof data !== "object" || !data.entries) {
|
|
25
|
+
console.warn(`Invalid audio-map.json structure at ${filePath}, creating new`);
|
|
26
|
+
return createEmptyAudioMap();
|
|
27
|
+
}
|
|
28
|
+
return data;
|
|
29
|
+
}
|
|
30
|
+
catch (error) {
|
|
31
|
+
if (error.code === "ENOENT") {
|
|
32
|
+
return createEmptyAudioMap();
|
|
33
|
+
}
|
|
34
|
+
throw error;
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Save the audio map to disk.
|
|
39
|
+
* Creates parent directories if they don't exist.
|
|
40
|
+
*
|
|
41
|
+
* @param filePath - Path to audio-map.json
|
|
42
|
+
* @param audioMap - The audio map to save
|
|
43
|
+
*/
|
|
44
|
+
export async function saveAudioMap(filePath, audioMap) {
|
|
45
|
+
// Update timestamp
|
|
46
|
+
audioMap.updatedAt = new Date().toISOString();
|
|
47
|
+
// Ensure directory exists
|
|
48
|
+
const dir = dirname(filePath);
|
|
49
|
+
await mkdir(dir, { recursive: true });
|
|
50
|
+
// Write with pretty formatting
|
|
51
|
+
const content = JSON.stringify(audioMap, null, 2);
|
|
52
|
+
await writeFile(filePath, content, "utf-8");
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get an audio entry by slug.
|
|
56
|
+
*
|
|
57
|
+
* @param audioMap - The audio map
|
|
58
|
+
* @param slug - The content slug
|
|
59
|
+
* @returns The audio artifact or undefined
|
|
60
|
+
*/
|
|
61
|
+
export function getAudioEntry(audioMap, slug) {
|
|
62
|
+
return audioMap.entries[slug];
|
|
63
|
+
}
|
|
64
|
+
/**
|
|
65
|
+
* Set an audio entry for a slug.
|
|
66
|
+
*
|
|
67
|
+
* @param audioMap - The audio map to modify
|
|
68
|
+
* @param slug - The content slug
|
|
69
|
+
* @param artifact - The audio artifact
|
|
70
|
+
*/
|
|
71
|
+
export function setAudioEntry(audioMap, slug, artifact) {
|
|
72
|
+
audioMap.entries[slug] = artifact;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Remove an audio entry by slug.
|
|
76
|
+
*
|
|
77
|
+
* @param audioMap - The audio map to modify
|
|
78
|
+
* @param slug - The content slug
|
|
79
|
+
* @returns True if entry was removed
|
|
80
|
+
*/
|
|
81
|
+
export function removeAudioEntry(audioMap, slug) {
|
|
82
|
+
if (slug in audioMap.entries) {
|
|
83
|
+
delete audioMap.entries[slug];
|
|
84
|
+
return true;
|
|
85
|
+
}
|
|
86
|
+
return false;
|
|
87
|
+
}
|
|
88
|
+
/**
|
|
89
|
+
* Get all slugs that have audio entries.
|
|
90
|
+
*
|
|
91
|
+
* @param audioMap - The audio map
|
|
92
|
+
* @returns Array of slugs
|
|
93
|
+
*/
|
|
94
|
+
export function getAudioSlugs(audioMap) {
|
|
95
|
+
return Object.keys(audioMap.entries);
|
|
96
|
+
}
|
|
97
|
+
//# sourceMappingURL=audio-map.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"audio-map.js","sourceRoot":"","sources":["../../src/core/audio-map.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AAC9D,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC;;GAEG;AACH,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,OAAO,EAAE,CAAC;QACV,SAAS,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QACnC,OAAO,EAAE,EAAE;KACZ,CAAC;AACJ,CAAC;AAED;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAgB;IACjD,IAAI,CAAC;QACH,MAAM,OAAO,GAAG,MAAM,QAAQ,CAAC,QAAQ,EAAE,OAAO,CAAC,CAAC;QAClD,MAAM,IAAI,GAAG,IAAI,CAAC,KAAK,CAAC,OAAO,CAAa,CAAC;QAE7C,2BAA2B;QAC3B,IAAI,OAAO,IAAI,KAAK,QAAQ,IAAI,CAAC,IAAI,CAAC,OAAO,EAAE,CAAC;YAC9C,OAAO,CAAC,IAAI,CAAC,uCAAuC,QAAQ,gBAAgB,CAAC,CAAC;YAC9E,OAAO,mBAAmB,EAAE,CAAC;QAC/B,CAAC;QAED,OAAO,IAAI,CAAC;IACd,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAK,KAA+B,CAAC,IAAI,KAAK,QAAQ,EAAE,CAAC;YACvD,OAAO,mBAAmB,EAAE,CAAC;QAC/B,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAAC,QAAg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|
4
|
+
* Load all content items from a collection.
|
|
5
|
+
*
|
|
6
|
+
* @param config - Collection configuration
|
|
7
|
+
* @param frontmatterField - Optional field to filter by (items with false are skipped)
|
|
8
|
+
*/
|
|
9
|
+
export declare function loadContent(config: CollectionConfig, frontmatterField?: string): Promise<ContentItem[]>;
|
|
10
|
+
/**
|
|
11
|
+
* Load a single content item by slug.
|
|
12
|
+
*
|
|
13
|
+
* @param config - Collection configuration
|
|
14
|
+
* @param targetSlug - The slug to find
|
|
15
|
+
*/
|
|
16
|
+
export declare function loadContentBySlug(config: CollectionConfig, targetSlug: string): Promise<ContentItem | undefined>;
|
|
17
|
+
//# sourceMappingURL=content-loader.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"content-loader.d.ts","sourceRoot":"","sources":["../../src/core/content-loader.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AACrD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAC;AAyG3D;;;;;GAKG;AACH,wBAAsB,WAAW,CAC/B,MAAM,EAAE,gBAAgB,EACxB,gBAAgB,CAAC,EAAE,MAAM,GACxB,OAAO,CAAC,WAAW,EAAE,CAAC,CAuCxB;AAED;;;;;GAKG;AACH,wBAAsB,iBAAiB,CACrC,MAAM,EAAE,gBAAgB,EACxB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,WAAW,GAAG,SAAS,CAAC,CAGlC"}
|