folderblog 0.0.2 → 0.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.
Files changed (61) hide show
  1. package/dist/{chunk-24MKFHML.cjs → chunk-2TZSVPNP.cjs} +5 -0
  2. package/dist/{chunk-HMQIQUPB.cjs → chunk-6TFXNIO6.cjs} +108 -0
  3. package/dist/{chunk-ZRUBI3GH.js → chunk-B43UAOPC.js} +106 -1
  4. package/dist/{chunk-XP5J4LFJ.js → chunk-D26H5722.js} +5 -0
  5. package/dist/chunk-E7PYGJA7.cjs +39 -0
  6. package/dist/{chunk-QA4KPPTA.cjs → chunk-J3Y3HEBF.cjs} +84 -13
  7. package/dist/{chunk-PARGDJNY.js → chunk-K76XLEC7.js} +1 -1
  8. package/dist/{chunk-IXP35S24.js → chunk-LPPBVXJ7.js} +83 -12
  9. package/dist/chunk-Q6EXKX6K.js +17 -0
  10. package/dist/{chunk-4ZJGUMHS.cjs → chunk-Q6EYTOTM.cjs} +2 -2
  11. package/dist/chunk-UCXXH2MP.cjs +20 -0
  12. package/dist/chunk-XQD3UUL5.js +34 -0
  13. package/dist/cli/bin.cjs +5 -5
  14. package/dist/cli/bin.js +4 -4
  15. package/dist/cli/index.cjs +5 -5
  16. package/dist/cli/index.js +4 -4
  17. package/dist/config-ADPY6IQS.d.cts +473 -0
  18. package/dist/config-Dctsdeo6.d.ts +473 -0
  19. package/dist/index.cjs +157 -187
  20. package/dist/index.d.cts +4 -3
  21. package/dist/index.d.ts +4 -3
  22. package/dist/index.js +16 -69
  23. package/dist/local/index.cjs +785 -0
  24. package/dist/local/index.d.cts +268 -0
  25. package/dist/local/index.d.ts +268 -0
  26. package/dist/local/index.js +772 -0
  27. package/dist/output-0P0br3Jc.d.cts +452 -0
  28. package/dist/output-0P0br3Jc.d.ts +452 -0
  29. package/dist/plugins/embed-cloudflare-ai.cjs +166 -0
  30. package/dist/plugins/embed-cloudflare-ai.d.cts +73 -0
  31. package/dist/plugins/embed-cloudflare-ai.d.ts +73 -0
  32. package/dist/plugins/embed-cloudflare-ai.js +156 -0
  33. package/dist/plugins/embed-transformers.cjs +121 -0
  34. package/dist/plugins/embed-transformers.d.cts +55 -0
  35. package/dist/plugins/embed-transformers.d.ts +55 -0
  36. package/dist/plugins/embed-transformers.js +113 -0
  37. package/dist/plugins/similarity.cjs +19 -0
  38. package/dist/plugins/similarity.d.cts +41 -0
  39. package/dist/plugins/similarity.d.ts +41 -0
  40. package/dist/plugins/similarity.js +2 -0
  41. package/dist/processor/index.cjs +123 -111
  42. package/dist/processor/index.d.cts +6 -2
  43. package/dist/processor/index.d.ts +6 -2
  44. package/dist/processor/index.js +3 -3
  45. package/dist/processor/plugins.cjs +24 -12
  46. package/dist/processor/plugins.d.cts +4 -2
  47. package/dist/processor/plugins.d.ts +4 -2
  48. package/dist/processor/plugins.js +1 -1
  49. package/dist/processor/types.cjs +16 -16
  50. package/dist/processor/types.d.cts +3 -2
  51. package/dist/processor/types.d.ts +3 -2
  52. package/dist/processor/types.js +1 -1
  53. package/dist/seo/index.cjs +289 -0
  54. package/dist/seo/index.d.cts +95 -0
  55. package/dist/seo/index.d.ts +95 -0
  56. package/dist/seo/index.js +274 -0
  57. package/dist/server/index.cjs +2 -5
  58. package/dist/server/index.js +2 -5
  59. package/package.json +36 -1
  60. package/dist/config-DFr-htlO.d.cts +0 -887
  61. package/dist/config-DFr-htlO.d.ts +0 -887
@@ -0,0 +1,452 @@
1
+ /**
2
+ * Issue tracking types for @repo-md/processor-core
3
+ */
4
+ type IssueSeverity = 'error' | 'warning' | 'info';
5
+ type IssueCategory = 'broken-link' | 'missing-media' | 'media-processing' | 'slug-conflict' | 'mermaid-error' | 'frontmatter-error' | 'parse-error' | 'file-access' | 'embedding-error' | 'database-error' | 'plugin-error' | 'configuration' | 'other';
6
+ type IssueModule = 'markdown-parser' | 'image-processor' | 'embed-mermaid' | 'embed-media' | 'link-resolver' | 'slug-generator' | 'frontmatter-parser' | 'file-system' | 'config-validator' | 'post-processor' | 'text-embeddings' | 'image-embeddings' | 'similarity' | 'database' | 'plugin-manager' | 'other';
7
+ /**
8
+ * Base interface for all processing issues
9
+ */
10
+ interface ProcessingIssue {
11
+ readonly severity: IssueSeverity;
12
+ readonly category: IssueCategory;
13
+ readonly module: IssueModule;
14
+ readonly message: string;
15
+ readonly filePath?: string;
16
+ readonly lineNumber?: number;
17
+ readonly columnNumber?: number;
18
+ readonly context?: Readonly<Record<string, unknown>>;
19
+ readonly timestamp: string;
20
+ }
21
+ /**
22
+ * Broken link issue
23
+ */
24
+ interface BrokenLinkIssue extends ProcessingIssue {
25
+ readonly category: 'broken-link';
26
+ readonly module: 'link-resolver';
27
+ readonly context: {
28
+ readonly linkText: string;
29
+ readonly linkTarget: string;
30
+ readonly linkType: 'wiki' | 'markdown' | 'frontmatter';
31
+ readonly suggestions?: readonly string[];
32
+ };
33
+ }
34
+ /**
35
+ * Missing media issue
36
+ */
37
+ interface MissingMediaIssue extends ProcessingIssue {
38
+ readonly category: 'missing-media';
39
+ readonly module: 'embed-media' | 'image-processor';
40
+ readonly context: {
41
+ readonly mediaPath: string;
42
+ readonly referencedFrom: 'content' | 'frontmatter' | 'embed';
43
+ readonly originalReference?: string;
44
+ };
45
+ }
46
+ /**
47
+ * Media processing issue
48
+ */
49
+ interface MediaProcessingIssue extends ProcessingIssue {
50
+ readonly category: 'media-processing';
51
+ readonly module: 'image-processor';
52
+ readonly context: {
53
+ readonly mediaPath: string;
54
+ readonly operation: 'read' | 'optimize' | 'resize' | 'hash' | 'copy';
55
+ readonly errorMessage: string;
56
+ readonly errorCode?: string;
57
+ };
58
+ }
59
+ /**
60
+ * Slug conflict issue
61
+ */
62
+ interface SlugConflictIssue extends ProcessingIssue {
63
+ readonly category: 'slug-conflict';
64
+ readonly module: 'slug-generator';
65
+ readonly context: {
66
+ readonly originalSlug: string;
67
+ readonly finalSlug: string;
68
+ readonly conflictingFiles: readonly string[];
69
+ };
70
+ }
71
+ /**
72
+ * Mermaid error issue
73
+ */
74
+ interface MermaidErrorIssue extends ProcessingIssue {
75
+ readonly category: 'mermaid-error';
76
+ readonly module: 'embed-mermaid';
77
+ readonly context: {
78
+ readonly errorType: 'plugin-load' | 'render-fail' | 'missing-deps';
79
+ readonly diagramContent?: string;
80
+ readonly fallback: string;
81
+ };
82
+ }
83
+ /**
84
+ * Embedding error issue
85
+ */
86
+ interface EmbeddingErrorIssue extends ProcessingIssue {
87
+ readonly category: 'embedding-error';
88
+ readonly module: 'text-embeddings' | 'image-embeddings';
89
+ readonly context: {
90
+ readonly embeddingType: 'text' | 'image';
91
+ readonly operation: 'initialize' | 'embed' | 'batch';
92
+ readonly errorMessage: string;
93
+ };
94
+ }
95
+ /**
96
+ * Plugin error issue
97
+ */
98
+ interface PluginErrorIssue extends ProcessingIssue {
99
+ readonly category: 'plugin-error';
100
+ readonly module: 'plugin-manager';
101
+ readonly context: {
102
+ readonly pluginName: string;
103
+ readonly operation: 'initialize' | 'process' | 'dispose';
104
+ readonly errorMessage: string;
105
+ };
106
+ }
107
+ declare const isBrokenLinkIssue: (issue: ProcessingIssue) => issue is BrokenLinkIssue;
108
+ declare const isMissingMediaIssue: (issue: ProcessingIssue) => issue is MissingMediaIssue;
109
+ declare const isMediaProcessingIssue: (issue: ProcessingIssue) => issue is MediaProcessingIssue;
110
+ declare const isSlugConflictIssue: (issue: ProcessingIssue) => issue is SlugConflictIssue;
111
+ declare const isMermaidErrorIssue: (issue: ProcessingIssue) => issue is MermaidErrorIssue;
112
+ declare const isEmbeddingErrorIssue: (issue: ProcessingIssue) => issue is EmbeddingErrorIssue;
113
+ declare const isPluginErrorIssue: (issue: ProcessingIssue) => issue is PluginErrorIssue;
114
+ interface IssueSummary {
115
+ readonly totalIssues: number;
116
+ readonly errorCount: number;
117
+ readonly warningCount: number;
118
+ readonly infoCount: number;
119
+ readonly filesAffected: number;
120
+ readonly categoryCounts: Readonly<Record<IssueCategory, number>>;
121
+ readonly moduleCounts: Readonly<Record<IssueModule, number>>;
122
+ }
123
+ interface IssueReport {
124
+ readonly issues: readonly ProcessingIssue[];
125
+ readonly summary: IssueSummary;
126
+ readonly metadata: {
127
+ readonly processStartTime: string;
128
+ readonly processEndTime: string;
129
+ readonly processorVersion?: string;
130
+ };
131
+ }
132
+ interface IssueFilterOptions {
133
+ readonly severity?: IssueSeverity | readonly IssueSeverity[];
134
+ readonly category?: IssueCategory | readonly IssueCategory[];
135
+ readonly module?: IssueModule | readonly IssueModule[];
136
+ readonly filePath?: string | readonly string[];
137
+ }
138
+
139
+ /**
140
+ * Cache types for @repo-md/processor-core
141
+ *
142
+ * These types support incremental builds by allowing the processor
143
+ * to skip re-processing files that haven't changed.
144
+ */
145
+
146
+ /**
147
+ * Cached metadata for a previously processed media file.
148
+ * Contains all information needed to skip image processing
149
+ * while still generating correct HTML output with dimensions.
150
+ */
151
+ interface CachedMediaMetadata {
152
+ /** Original image width */
153
+ readonly width: number;
154
+ /** Original image height */
155
+ readonly height: number;
156
+ /** Output format (webp, avif, jpeg, png) */
157
+ readonly format: string;
158
+ /** Output file size in bytes */
159
+ readonly size: number;
160
+ /** Original file size in bytes */
161
+ readonly originalSize?: number;
162
+ /** Output file path relative to media output dir */
163
+ readonly outputPath: string;
164
+ /** Responsive size variants */
165
+ readonly sizes: readonly CachedMediaSizeVariant[];
166
+ }
167
+ /**
168
+ * Cached size variant for responsive images
169
+ */
170
+ interface CachedMediaSizeVariant {
171
+ /** Size suffix (xs, sm, md, lg, xl) */
172
+ readonly suffix: string;
173
+ /** Output file path relative to media output dir */
174
+ readonly outputPath: string;
175
+ /** Width of this variant */
176
+ readonly width: number;
177
+ /** Height of this variant */
178
+ readonly height: number;
179
+ /** File size in bytes */
180
+ readonly size: number;
181
+ }
182
+ /**
183
+ * Cache context passed to the processor for incremental builds.
184
+ * All caches are keyed by content hash (SHA-256).
185
+ */
186
+ interface CacheContext {
187
+ /**
188
+ * Cached media metadata keyed by content hash.
189
+ * When a media file's hash matches a cached entry, processing can be skipped
190
+ * and the cached metadata used for HTML rendering (dimensions, paths).
191
+ */
192
+ readonly media?: ReadonlyMap<string, CachedMediaMetadata>;
193
+ /**
194
+ * Cached text embeddings keyed by post content hash.
195
+ * When a post's hash matches a cached entry, embedding generation
196
+ * can be skipped and the cached vector used directly.
197
+ */
198
+ readonly textEmbeddings?: ReadonlyMap<string, readonly number[]>;
199
+ /**
200
+ * Cached image embeddings keyed by media content hash.
201
+ * When a media file's hash matches a cached entry, CLIP embedding
202
+ * generation can be skipped and the cached vector used directly.
203
+ */
204
+ readonly imageEmbeddings?: ReadonlyMap<string, readonly number[]>;
205
+ }
206
+ /**
207
+ * Statistics about cache usage during processing
208
+ */
209
+ interface CacheStats {
210
+ /** Number of media files that used cached metadata */
211
+ readonly mediaCacheHits: number;
212
+ /** Number of media files that were processed fresh */
213
+ readonly mediaCacheMisses: number;
214
+ /** Number of posts that used cached text embeddings */
215
+ readonly textEmbeddingCacheHits: number;
216
+ /** Number of posts that required fresh text embedding generation */
217
+ readonly textEmbeddingCacheMisses: number;
218
+ /** Number of media files that used cached image embeddings */
219
+ readonly imageEmbeddingCacheHits: number;
220
+ /** Number of media files that required fresh image embedding generation */
221
+ readonly imageEmbeddingCacheMisses: number;
222
+ }
223
+ /**
224
+ * Create empty cache statistics
225
+ */
226
+ declare const createEmptyCacheStats: () => CacheStats;
227
+ /**
228
+ * Build a media cache from a medias.json file structure
229
+ */
230
+ declare function buildMediaCacheFromManifest(medias: readonly {
231
+ metadata?: MediaMetadata;
232
+ outputPath: string;
233
+ sizes?: readonly MediaSizeVariant[];
234
+ }[]): Map<string, CachedMediaMetadata>;
235
+ /**
236
+ * Build an embedding cache from an embedding hash map file structure
237
+ */
238
+ declare function buildEmbeddingCacheFromManifest(embeddingMap: Record<string, readonly number[]>): Map<string, readonly number[]>;
239
+
240
+ /**
241
+ * Output types for @repo-md/processor-core
242
+ */
243
+
244
+ interface TocItem {
245
+ readonly text: string;
246
+ readonly depth: number;
247
+ readonly slug: string;
248
+ }
249
+ interface PostMetadata {
250
+ readonly createdAt: string;
251
+ readonly modifiedAt: string;
252
+ readonly processedAt: string;
253
+ readonly gitCreatedAt?: string;
254
+ readonly gitModifiedAt?: string;
255
+ }
256
+ interface PostCoverSize {
257
+ /** Size suffix (xs, sm, md, lg, xl) */
258
+ readonly suffix: string;
259
+ /** Output file path relative to output dir */
260
+ readonly path: string;
261
+ /** Full URL if domain configured */
262
+ readonly url?: string;
263
+ /** Width of this variant */
264
+ readonly width: number;
265
+ /** Height of this variant */
266
+ readonly height: number;
267
+ }
268
+ interface PostCover {
269
+ /** Original path from frontmatter */
270
+ readonly original: string;
271
+ /** Output file path relative to output dir */
272
+ readonly path: string;
273
+ /** Full URL if domain configured */
274
+ readonly url?: string;
275
+ /** Content hash */
276
+ readonly hash?: string;
277
+ /** Image width */
278
+ readonly width?: number;
279
+ /** Image height */
280
+ readonly height?: number;
281
+ /** Responsive image size variants */
282
+ readonly sizes?: readonly PostCoverSize[];
283
+ }
284
+ interface PostCoverError {
285
+ /** Original path from frontmatter */
286
+ readonly original: string;
287
+ /** Error message explaining why cover couldn't be resolved */
288
+ readonly error: string;
289
+ }
290
+ interface ProcessedPost {
291
+ /** Content hash for identification */
292
+ readonly hash: string;
293
+ /** URL-friendly slug */
294
+ readonly slug: string;
295
+ /** Post title (from frontmatter or filename) */
296
+ readonly title: string;
297
+ /** Original filename without extension */
298
+ readonly fileName: string;
299
+ /** Original file path relative to input directory */
300
+ readonly originalPath: string;
301
+ /** Rendered HTML content */
302
+ readonly content: string;
303
+ /** Original markdown content */
304
+ readonly markdown: string;
305
+ /** Plain text content (for search/embeddings) */
306
+ readonly plainText: string;
307
+ /** Excerpt/summary text */
308
+ readonly excerpt: string;
309
+ /** Word count */
310
+ readonly wordCount: number;
311
+ /** Table of contents */
312
+ readonly toc: readonly TocItem[];
313
+ /** Frontmatter data */
314
+ readonly frontmatter: Readonly<Record<string, unknown>>;
315
+ /** Timestamps and metadata */
316
+ readonly metadata: PostMetadata;
317
+ /** Cover image (resolved from frontmatter.cover) */
318
+ readonly cover?: PostCover | PostCoverError;
319
+ /** URL of first image (for cover) */
320
+ readonly firstImage?: string;
321
+ /** Hashes of posts this post links to */
322
+ readonly links?: readonly string[];
323
+ /** Text embedding vector */
324
+ readonly embedding?: readonly number[];
325
+ }
326
+ interface MediaMetadata {
327
+ readonly width?: number;
328
+ readonly height?: number;
329
+ readonly format?: string;
330
+ readonly size?: number;
331
+ readonly originalSize?: number;
332
+ readonly hash?: string;
333
+ }
334
+ interface MediaSizeVariant {
335
+ /** Size suffix (xs, sm, md, lg, xl) */
336
+ readonly suffix: string;
337
+ /** Output file path relative to output dir */
338
+ readonly outputPath: string;
339
+ /** Width of this variant */
340
+ readonly width: number;
341
+ /** Height of this variant */
342
+ readonly height: number;
343
+ /** File size in bytes */
344
+ readonly size: number;
345
+ }
346
+ interface ProcessedMedia {
347
+ /** Original file path relative to input */
348
+ readonly originalPath: string;
349
+ /** Output file path relative to output dir */
350
+ readonly outputPath: string;
351
+ /** Original filename */
352
+ readonly fileName: string;
353
+ /** Media type */
354
+ readonly type: 'image' | 'video' | 'audio' | 'media';
355
+ /** File metadata */
356
+ readonly metadata?: MediaMetadata;
357
+ /** Responsive image size variants */
358
+ readonly sizes?: readonly MediaSizeVariant[];
359
+ /** Image embedding vector */
360
+ readonly embedding?: readonly number[];
361
+ }
362
+ type RelationshipType = 'POST_LINKS_TO_POST' | 'POST_USE_IMAGE';
363
+ interface GraphNode {
364
+ readonly id: string;
365
+ readonly type: 'post' | 'media';
366
+ readonly label: string;
367
+ }
368
+ interface GraphEdge {
369
+ readonly source: string;
370
+ readonly target: string;
371
+ readonly type: RelationshipType;
372
+ }
373
+ interface GraphData {
374
+ readonly nodes: readonly GraphNode[];
375
+ readonly edges: readonly GraphEdge[];
376
+ }
377
+ /** Maps original paths to optimized public paths */
378
+ type MediaPathMap = Readonly<Record<string, string>>;
379
+ /** Maps original paths to content hashes */
380
+ type PathHashMap = Readonly<Record<string, string>>;
381
+ /** Maps slugs to post hashes */
382
+ type SlugHashMap = Readonly<Record<string, string>>;
383
+ /** Maps hashes to embedding vectors */
384
+ type EmbeddingMap = ReadonlyMap<string, readonly number[]>;
385
+ interface OutputFiles {
386
+ readonly posts: string;
387
+ readonly media: string;
388
+ readonly slugMap: string;
389
+ readonly pathMap: string;
390
+ readonly issues: string;
391
+ readonly graph?: string;
392
+ readonly similarity?: string;
393
+ readonly database?: string;
394
+ }
395
+ interface BuildReport {
396
+ /** Text embedding stats (if embeddings were generated) */
397
+ readonly postEmbeddings?: {
398
+ readonly filesProcessed: number;
399
+ readonly dimensions: number;
400
+ readonly model: string;
401
+ };
402
+ /** Image embedding stats (if image embeddings were generated) */
403
+ readonly mediaEmbeddings?: {
404
+ readonly filesProcessed: number;
405
+ readonly dimensions: number;
406
+ readonly model: string;
407
+ };
408
+ /** Similarity computation stats */
409
+ readonly similarity?: {
410
+ readonly pairsComputed: number;
411
+ readonly topN: number;
412
+ readonly postsWithEmbeddings: number;
413
+ };
414
+ /** Phase timing in milliseconds */
415
+ readonly timing?: {
416
+ readonly totalMs: number;
417
+ readonly phases: Readonly<Record<string, number>>;
418
+ };
419
+ }
420
+ interface ProcessResult {
421
+ /** Processed posts */
422
+ readonly posts: readonly ProcessedPost[];
423
+ /** Processed media files */
424
+ readonly media: readonly ProcessedMedia[];
425
+ /** Output directory path */
426
+ readonly outputDir: string;
427
+ /** Output file paths */
428
+ readonly outputFiles: OutputFiles;
429
+ /** Processing issues report */
430
+ readonly issues: IssueReport;
431
+ /** Graph data (if trackRelationships enabled) */
432
+ readonly graph?: GraphData;
433
+ /** Cache statistics (if cache was provided) */
434
+ readonly cacheStats?: CacheStats;
435
+ /** Build report with stats about embeddings, similarity, timing */
436
+ readonly report?: BuildReport;
437
+ }
438
+ declare const OUTPUT_FILES: {
439
+ readonly POSTS: "posts.json";
440
+ readonly POSTS_SLUG_MAP: "posts-slug-map.json";
441
+ readonly POSTS_PATH_MAP: "posts-path-map.json";
442
+ readonly MEDIAS: "media.json";
443
+ readonly MEDIA_PATH_MAP: "media-path-map.json";
444
+ readonly GRAPH: "graph.json";
445
+ readonly TEXT_EMBEDDINGS: "posts-embedding-hash-map.json";
446
+ readonly IMAGE_EMBEDDINGS: "media-embedding-hash-map.json";
447
+ readonly SIMILARITY: "similarity.json";
448
+ readonly DATABASE: "repo.db";
449
+ readonly ISSUES: "processor-issues.json";
450
+ };
451
+
452
+ export { type ProcessResult as A, type BrokenLinkIssue as B, type CacheContext as C, type SlugHashMap as D, type EmbeddingErrorIssue as E, buildEmbeddingCacheFromManifest as F, type GraphData as G, buildMediaCacheFromManifest as H, type IssueFilterOptions as I, createEmptyCacheStats as J, isBrokenLinkIssue as K, isEmbeddingErrorIssue as L, type MediaMetadata as M, isMediaProcessingIssue as N, OUTPUT_FILES as O, type ProcessingIssue as P, isMermaidErrorIssue as Q, type RelationshipType as R, type SlugConflictIssue as S, type TocItem as T, isMissingMediaIssue as U, isPluginErrorIssue as V, isSlugConflictIssue as W, type IssueSeverity as a, type IssueReport as b, type IssueSummary as c, type ProcessedPost as d, type ProcessedMedia as e, type BuildReport as f, type CacheStats as g, type CachedMediaMetadata as h, type CachedMediaSizeVariant as i, type EmbeddingMap as j, type GraphEdge as k, type GraphNode as l, type IssueCategory as m, type IssueModule as n, type MediaPathMap as o, type MediaProcessingIssue as p, type MediaSizeVariant as q, type MermaidErrorIssue as r, type MissingMediaIssue as s, type OutputFiles as t, type PathHashMap as u, type PluginErrorIssue as v, type PostCover as w, type PostCoverError as x, type PostCoverSize as y, type PostMetadata as z };