mark-deco 0.2.0 → 0.4.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.
Files changed (76) hide show
  1. package/README-package.md +120 -0
  2. package/README.md +14 -1301
  3. package/dist/cache/filesystem.d.ts +10 -0
  4. package/dist/cache/filesystem.d.ts.map +1 -0
  5. package/dist/cache/index.d.ts +38 -0
  6. package/dist/cache/index.d.ts.map +1 -0
  7. package/dist/cache/localstorage.d.ts +9 -0
  8. package/dist/cache/localstorage.d.ts.map +1 -0
  9. package/dist/cache/memory.d.ts +8 -0
  10. package/dist/cache/memory.d.ts.map +1 -0
  11. package/dist/fetcher.d.ts +80 -0
  12. package/dist/fetcher.d.ts.map +1 -0
  13. package/dist/frontmatter.d.ts +14 -0
  14. package/dist/frontmatter.d.ts.map +1 -0
  15. package/dist/index.d.ts +13 -0
  16. package/dist/index.d.ts.map +1 -0
  17. package/dist/internal.d.ts +9 -0
  18. package/dist/internal.d.ts.map +1 -0
  19. package/dist/logger.d.ts +12 -0
  20. package/dist/logger.d.ts.map +1 -0
  21. package/dist/plugins/card/amazon-rules.d.ts +6 -0
  22. package/dist/plugins/card/amazon-rules.d.ts.map +1 -0
  23. package/dist/plugins/card/fetcher.d.ts +7 -0
  24. package/dist/plugins/card/fetcher.d.ts.map +1 -0
  25. package/dist/plugins/card/html-generator.d.ts +10 -0
  26. package/dist/plugins/card/html-generator.d.ts.map +1 -0
  27. package/dist/plugins/card/index.d.ts +10 -0
  28. package/dist/plugins/card/index.d.ts.map +1 -0
  29. package/dist/plugins/card/ogp-rules.d.ts +25 -0
  30. package/dist/plugins/card/ogp-rules.d.ts.map +1 -0
  31. package/dist/plugins/card/rule-engine.d.ts +12 -0
  32. package/dist/plugins/card/rule-engine.d.ts.map +1 -0
  33. package/dist/plugins/card/types.d.ts +99 -0
  34. package/dist/plugins/card/types.d.ts.map +1 -0
  35. package/dist/plugins/card/utils.d.ts +32 -0
  36. package/dist/plugins/card/utils.d.ts.map +1 -0
  37. package/dist/plugins/card-plugin.d.ts +2 -0
  38. package/dist/plugins/card-plugin.d.ts.map +1 -0
  39. package/dist/plugins/mermaid/index.d.ts +9 -0
  40. package/dist/plugins/mermaid/index.d.ts.map +1 -0
  41. package/dist/plugins/mermaid/types.d.ts +10 -0
  42. package/dist/plugins/mermaid/types.d.ts.map +1 -0
  43. package/dist/plugins/mermaid-plugin.d.ts +2 -0
  44. package/dist/plugins/mermaid-plugin.d.ts.map +1 -0
  45. package/dist/plugins/oembed/fetcher.d.ts +13 -0
  46. package/dist/plugins/oembed/fetcher.d.ts.map +1 -0
  47. package/dist/plugins/oembed/html-generator.d.ts +10 -0
  48. package/dist/plugins/oembed/html-generator.d.ts.map +1 -0
  49. package/dist/plugins/oembed/index.d.ts +10 -0
  50. package/dist/plugins/oembed/index.d.ts.map +1 -0
  51. package/dist/plugins/oembed/providers.d.ts +26 -0
  52. package/dist/plugins/oembed/providers.d.ts.map +1 -0
  53. package/dist/plugins/oembed/providers.json.d.ts +5074 -0
  54. package/dist/plugins/oembed/redirect-resolver.d.ts +6 -0
  55. package/dist/plugins/oembed/redirect-resolver.d.ts.map +1 -0
  56. package/dist/plugins/oembed/types.d.ts +87 -0
  57. package/dist/plugins/oembed/types.d.ts.map +1 -0
  58. package/dist/plugins/oembed/utils.d.ts +17 -0
  59. package/dist/plugins/oembed/utils.d.ts.map +1 -0
  60. package/dist/plugins/oembed-plugin.d.ts +2 -0
  61. package/dist/plugins/oembed-plugin.d.ts.map +1 -0
  62. package/dist/plugins/remark-attr.d.ts +8 -0
  63. package/dist/plugins/remark-attr.d.ts.map +1 -0
  64. package/dist/plugins/responsive-images.d.ts +7 -0
  65. package/dist/plugins/responsive-images.d.ts.map +1 -0
  66. package/dist/plugins/shared/error-formatter.d.ts +6 -0
  67. package/dist/plugins/shared/error-formatter.d.ts.map +1 -0
  68. package/dist/processor.d.ts +14 -0
  69. package/dist/processor.d.ts.map +1 -0
  70. package/dist/types.d.ts +139 -0
  71. package/dist/types.d.ts.map +1 -0
  72. package/dist/utils/responsive-image.d.ts +30 -0
  73. package/dist/utils/responsive-image.d.ts.map +1 -0
  74. package/dist/utils.d.ts +24 -0
  75. package/dist/utils.d.ts.map +1 -0
  76. package/package.json +11 -2
@@ -0,0 +1,10 @@
1
+ import { CacheStorage } from './index.js';
2
+ /**
3
+ * Create file system-based cache storage instance
4
+ * Uses Node.js file system to store cache entries as JSON files
5
+ * @param cacheDir - Directory path to store cache files (will be created if it doesn't exist)
6
+ * @returns FileSystemCache instance that uses file system
7
+ * @throws Error if file system operations fail or if not running in Node.js environment
8
+ */
9
+ export declare const createFileSystemCacheStorage: (cacheDir: string) => CacheStorage;
10
+ //# sourceMappingURL=filesystem.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"filesystem.d.ts","sourceRoot":"","sources":["../../src/cache/filesystem.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAoB3D;;;;;;GAMG;AACH,eAAO,MAAM,4BAA4B,GAAI,UAAU,MAAM,KAAG,YA8O/D,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * Cache entry with timestamp and TTL support
3
+ */
4
+ export interface CacheEntry {
5
+ /** Cached data as string */
6
+ data: string;
7
+ /** Unix timestamp when the entry was created */
8
+ timestamp: number;
9
+ /** Time to live in milliseconds (optional) */
10
+ ttl?: number;
11
+ }
12
+ /**
13
+ * Cache storage interface
14
+ */
15
+ export interface CacheStorage {
16
+ /** Retrieve cached data by key */
17
+ get(key: string): Promise<string | null>;
18
+ /** Store data in cache with optional TTL */
19
+ set(key: string, value: string, ttl?: number): Promise<void>;
20
+ /** Delete cached data by key */
21
+ delete(key: string): Promise<void>;
22
+ /** Clear all cached data */
23
+ clear(): Promise<void>;
24
+ /** Get the number of cached entries */
25
+ size(): Promise<number>;
26
+ }
27
+ /**
28
+ * Generate cache key from URL, accept header, and user agent
29
+ * @param url - The URL to cache
30
+ * @param accept - Accept header value
31
+ * @param userAgent - User agent string (optional)
32
+ * @returns Generated cache key string
33
+ */
34
+ export declare function generateCacheKey(url: string, accept: string, userAgent?: string): string;
35
+ export { createLocalCacheStorage } from './localstorage.js';
36
+ export { createMemoryCacheStorage } from './memory.js';
37
+ export { createFileSystemCacheStorage } from './filesystem.js';
38
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/cache/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,UAAU;IACzB,4BAA4B;IAC5B,IAAI,EAAE,MAAM,CAAC;IACb,gDAAgD;IAChD,SAAS,EAAE,MAAM,CAAC;IAClB,8CAA8C;IAC9C,GAAG,CAAC,EAAE,MAAM,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,GAAG,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACzC,4CAA4C;IAC5C,GAAG,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IAC7D,gCAAgC;IAChC,MAAM,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC;IACnC,4BAA4B;IAC5B,KAAK,IAAI,OAAO,CAAC,IAAI,CAAC,CAAC;IACvB,uCAAuC;IACvC,IAAI,IAAI,OAAO,CAAC,MAAM,CAAC,CAAC;CACzB;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,CAGxF;AAGD,OAAO,EAAE,uBAAuB,EAAE,MAAM,mBAAmB,CAAC;AAC5D,OAAO,EAAE,wBAAwB,EAAE,MAAM,aAAa,CAAC;AACvD,OAAO,EAAE,4BAA4B,EAAE,MAAM,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { CacheStorage } from './index.js';
2
+ /**
3
+ * Create localStorage-based cache storage instance
4
+ * @param keyPrefix - Prefix for localStorage keys (defaults to 'cache:')
5
+ * @returns LocalCache instance that uses localStorage
6
+ * @throws Error if localStorage is not available
7
+ */
8
+ export declare const createLocalCacheStorage: (keyPrefix?: string) => CacheStorage;
9
+ //# sourceMappingURL=localstorage.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"localstorage.d.ts","sourceRoot":"","sources":["../../src/cache/localstorage.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAE3D;;;;;GAKG;AACH,eAAO,MAAM,uBAAuB,GAAI,YAAW,MAAiB,KAAG,YAuQtE,CAAC"}
@@ -0,0 +1,8 @@
1
+ import { CacheStorage } from './index.js';
2
+ /**
3
+ * Create in-memory cache storage instance
4
+ * Uses in-memory cache implementation with minimal locking for thread safety
5
+ * @returns CacheStorage instance backed by in-memory Map
6
+ */
7
+ export declare const createMemoryCacheStorage: () => CacheStorage;
8
+ //# sourceMappingURL=memory.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"memory.d.ts","sourceRoot":"","sources":["../../src/cache/memory.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,YAAY,EAAc,MAAM,YAAY,CAAC;AAE3D;;;;GAIG;AACH,eAAO,MAAM,wBAAwB,QAAO,YA8H3C,CAAC"}
@@ -0,0 +1,80 @@
1
+ import { CacheStorage } from './cache/index.js';
2
+ import { Logger, FetcherType } from './types';
3
+ /**
4
+ * Check if an error is likely a CORS error
5
+ * @param error - The error to check
6
+ * @returns True if the error appears to be CORS-related
7
+ */
8
+ export declare const isCORSError: (error: unknown) => boolean;
9
+ /**
10
+ * Create timeout signal
11
+ * @param timeout - Timeout duration in milliseconds
12
+ * @returns AbortSignal that will trigger after the specified timeout
13
+ */
14
+ export declare const createTimeoutSignal: (timeout: number) => AbortSignal;
15
+ /**
16
+ * Combine multiple abort signals
17
+ * @param signals - Array of abort signals to combine
18
+ * @returns Combined abort signal that triggers when any input signal triggers
19
+ */
20
+ export declare const combineAbortSignals: (...signals: AbortSignal[]) => AbortSignal;
21
+ /**
22
+ * Fetch data from a URL with specified parameters
23
+ * @param url - The URL to fetch from
24
+ * @param accept - Accept header value
25
+ * @param userAgent - User agent string
26
+ * @param timeout - Timeout duration in milliseconds
27
+ * @param signal - Optional abort signal
28
+ * @param logger - Optional logger instance
29
+ * @returns Promise resolving to the HTTP response
30
+ */
31
+ export declare const fetchData: (url: string, accept: string, userAgent: string, timeout: number, signal: AbortSignal | undefined, logger?: Logger) => Promise<Response>;
32
+ /**
33
+ * Options for cached fetcher
34
+ */
35
+ export interface CachedFetcherOptions {
36
+ /** Enable caching (default: true) */
37
+ cache?: boolean;
38
+ /** Cache TTL in milliseconds (default: 1 hour) */
39
+ cacheTTL?: number;
40
+ /** Cache failures as well as successes (default: true) */
41
+ cacheFailures?: boolean;
42
+ /** TTL for cached failures in milliseconds (default: 5 minutes) */
43
+ failureCacheTTL?: number;
44
+ }
45
+ /**
46
+ * Create a cached fetcher with the specified userAgent and timeout
47
+ * @param userAgent - User-Agent string to use for requests (required)
48
+ * @param timeout - Timeout in milliseconds for requests (default: 60000ms)
49
+ * @param cacheStorage - Custom cache storage instance (optional)
50
+ * @param options - Caching options (optional)
51
+ * @returns FetcherType object that encapsulates the fetcher and userAgent
52
+ */
53
+ export declare const createCachedFetcher: (userAgent: string, timeout?: number, cacheStorage?: CacheStorage, options?: CachedFetcherOptions) => FetcherType;
54
+ /**
55
+ * Create a direct fetcher that does not use caching and directly accesses the network
56
+ * @param userAgent - User-Agent string to use for requests (required)
57
+ * @param timeout - Timeout in milliseconds for requests (default: 60000ms)
58
+ * @returns FetcherType object that encapsulates the fetcher and userAgent
59
+ */
60
+ export declare const createDirectFetcher: (userAgent: string, timeout?: number) => FetcherType;
61
+ /**
62
+ * Fetch text content from a URL using the provided fetcher
63
+ * @param fetcherInstance - The fetcher instance to use
64
+ * @param url - The URL to fetch from
65
+ * @param accept - Accept header value
66
+ * @param signal - Optional abort signal
67
+ * @param logger - Optional logger instance
68
+ * @returns Promise resolving to the text content
69
+ */
70
+ export declare const fetchText: (fetcherInstance: FetcherType, url: string, accept: string, signal: AbortSignal | undefined, logger?: Logger) => Promise<string>;
71
+ /**
72
+ * Fetch JSON content from a URL using the provided fetcher
73
+ * @param fetcherInstance - The fetcher instance to use
74
+ * @param url - The URL to fetch from
75
+ * @param signal - Optional abort signal
76
+ * @param logger - Optional logger instance
77
+ * @returns Promise resolving to the parsed JSON data
78
+ */
79
+ export declare const fetchJson: <T>(fetcherInstance: FetcherType, url: string, signal: AbortSignal | undefined, logger?: Logger) => Promise<T>;
80
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../src/fetcher.ts"],"names":[],"mappings":"AAAA,OAAO,EAA8C,KAAK,YAAY,EAAE,MAAM,kBAAkB,CAAC;AACjG,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,SAAS,CAAC;AAEnD;;;;GAIG;AACH,eAAO,MAAM,WAAW,GAAI,OAAO,OAAO,KAAG,OAa5C,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,SAAS,MAAM,KAAI,WAItD,CAAC;AAEF;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,GAAG,SAAS,WAAW,EAAE,KAAG,WAiB/D,CAAC;AAEF;;;;;;;;;GASG;AACH,eAAO,MAAM,SAAS,GAAU,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,WAAW,MAAM,EAAE,SAAS,MAAM,EAAE,QAAQ,WAAW,GAAG,SAAS,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,QAAQ,CAqBnK,CAAC;AAEF;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,qCAAqC;IACrC,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB,kDAAkD;IAClD,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,0DAA0D;IAC1D,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,mEAAmE;IACnE,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAeD;;;;;;;GAOG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,EACjB,UAAS,MAAc,EACvB,eAAe,YAAY,EAC3B,UAAU,oBAAoB,KAC7B,WAyHF,CAAC;AAEF;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,WAAW,MAAM,EACjB,UAAS,MAAc,KACtB,WAWF,CAAC;AAEF;;;;;;;;GAQG;AACH,eAAO,MAAM,SAAS,GAAU,iBAAiB,WAAW,EAAE,KAAK,MAAM,EAAE,QAAQ,MAAM,EAAE,QAAQ,WAAW,GAAG,SAAS,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,MAAM,CAG3J,CAAC;AAEF;;;;;;;GAOG;AACH,eAAO,MAAM,SAAS,GAAU,CAAC,EAAE,iBAAiB,WAAW,EAAE,KAAK,MAAM,EAAE,QAAQ,WAAW,GAAG,SAAS,EAAE,SAAS,MAAM,KAAG,OAAO,CAAC,CAAC,CAGzI,CAAC"}
@@ -0,0 +1,14 @@
1
+ import { FrontmatterData } from './types.js';
2
+ export interface ParsedFrontmatter {
3
+ /** Parsed frontmatter data */
4
+ readonly data: FrontmatterData;
5
+ /** Markdown content without frontmatter */
6
+ readonly content: string;
7
+ }
8
+ /**
9
+ * Parse frontmatter from markdown content
10
+ * @param content - Raw markdown content with possible frontmatter
11
+ * @returns Parsed frontmatter data and content
12
+ */
13
+ export declare function parseFrontmatter(content: string): ParsedFrontmatter;
14
+ //# sourceMappingURL=frontmatter.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../src/frontmatter.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,YAAY,CAAC;AAElD,MAAM,WAAW,iBAAiB;IAChC,8BAA8B;IAC9B,QAAQ,CAAC,IAAI,EAAE,eAAe,CAAC;IAC/B,2CAA2C;IAC3C,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;CAC1B;AAED;;;;GAIG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,MAAM,GAAG,iBAAiB,CAoCnE"}
@@ -0,0 +1,13 @@
1
+ export { createMarkdownProcessor, defaultHtmlOptions } from './processor.js';
2
+ export { createOEmbedPlugin } from './plugins/oembed-plugin.js';
3
+ export { createCardPlugin } from './plugins/card-plugin.js';
4
+ export { createMermaidPlugin } from './plugins/mermaid-plugin.js';
5
+ export { defaultProviderList } from './plugins/oembed/providers.js';
6
+ export { createCachedFetcher, createDirectFetcher } from './utils.js';
7
+ export type { CachedFetcherOptions } from './utils.js';
8
+ export { createMemoryCacheStorage, createLocalCacheStorage, createFileSystemCacheStorage, generateCacheKey } from './cache/index.js';
9
+ export type { CacheStorage } from './cache/index.js';
10
+ export { getNoOpLogger, getConsoleLogger } from './logger.js';
11
+ export type { Plugin, PluginContext, MarkdownProcessor, ProcessOptions, ProcessResult, FrontmatterData, Logger, LogLevel, FetcherType } from './types.js';
12
+ export type { OEmbedProvider } from './plugins/oembed/types.js';
13
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,uBAAuB,EAAE,kBAAkB,EAAE,MAAM,gBAAgB,CAAC;AAC7E,OAAO,EAAE,kBAAkB,EAAE,MAAM,4BAA4B,CAAC;AAChE,OAAO,EAAE,gBAAgB,EAAE,MAAM,0BAA0B,CAAC;AAC5D,OAAO,EAAE,mBAAmB,EAAE,MAAM,6BAA6B,CAAC;AAGlE,OAAO,EAAE,mBAAmB,EAAE,MAAM,+BAA+B,CAAC;AAGpE,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AACtE,YAAY,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AAGvD,OAAO,EAAE,wBAAwB,EAAE,uBAAuB,EAAE,4BAA4B,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACrI,YAAY,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAGrD,OAAO,EAAE,aAAa,EAAE,gBAAgB,EAAE,MAAM,aAAa,CAAC;AAG9D,YAAY,EACV,MAAM,EACN,aAAa,EACb,iBAAiB,EACjB,cAAc,EACd,aAAa,EACb,eAAe,EACf,MAAM,EACN,QAAQ,EACR,WAAW,EACZ,MAAM,YAAY,CAAC;AAGpB,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,9 @@
1
+ export { formatErrorInfo } from './plugins/shared/error-formatter.js';
2
+ export type { OEmbedResponse } from './plugins/oembed/types.js';
3
+ export { generateHtml, generateFallbackHtml } from './plugins/oembed/html-generator.js';
4
+ export { isValidUrl, escapeHtml, calculateAspectRatio, extractAspectRatioFromHtml } from './plugins/oembed/utils.js';
5
+ export { fetchOEmbedData, CORSError } from './plugins/oembed/fetcher.js';
6
+ export { generateCardHtml, generateFallbackHtml as generateCardFallbackHtml } from './plugins/card/html-generator.js';
7
+ export { isValidUrl as isValidCardUrl, escapeHtml as escapeCardHtml, extractDomain, resolveUrl, truncateText, cleanText, extractEnhancedData } from './plugins/card/utils.js';
8
+ export { fetchMetadata } from './plugins/card/fetcher.js';
9
+ //# sourceMappingURL=internal.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"internal.d.ts","sourceRoot":"","sources":["../src/internal.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,eAAe,EAAE,MAAM,qCAAqC,CAAC;AAGtE,YAAY,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAO,EACL,YAAY,EACZ,oBAAoB,EACrB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,UAAU,EACV,UAAU,EACV,oBAAoB,EACpB,0BAA0B,EAC3B,MAAM,2BAA2B,CAAC;AAEnC,OAAO,EACL,eAAe,EACf,SAAS,EACV,MAAM,6BAA6B,CAAC;AAIrC,OAAO,EACL,gBAAgB,EAChB,oBAAoB,IAAI,wBAAwB,EACjD,MAAM,kCAAkC,CAAC;AAC1C,OAAO,EACL,UAAU,IAAI,cAAc,EAC5B,UAAU,IAAI,cAAc,EAE5B,aAAa,EACb,UAAU,EACV,YAAY,EACZ,SAAS,EAET,mBAAmB,EACpB,MAAM,yBAAyB,CAAC;AAEjC,OAAO,EACL,aAAa,EACd,MAAM,2BAA2B,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { Logger } from './types';
2
+ /**
3
+ * Default no-op logger that doesn't output anything
4
+ * @returns Logger instance that performs no operations
5
+ */
6
+ export declare const getNoOpLogger: () => Logger;
7
+ /**
8
+ * Console logger that outputs to console
9
+ * @returns Logger instance that outputs to console
10
+ */
11
+ export declare const getConsoleLogger: () => Logger;
12
+ //# sourceMappingURL=logger.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"logger.d.ts","sourceRoot":"","sources":["../src/logger.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AAiBjC;;;GAGG;AACH,eAAO,MAAM,aAAa,cAAqB,CAAC;AAEhD;;;GAGG;AACH,eAAO,MAAM,gBAAgB,cAAuB,CAAC"}
@@ -0,0 +1,6 @@
1
+ import { ScrapingRule } from './types.js';
2
+ /**
3
+ * Amazon scraping rules for different locales
4
+ */
5
+ export declare const amazonRules: ScrapingRule[];
6
+ //# sourceMappingURL=amazon-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"amazon-rules.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/amazon-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;GAEG;AACH,eAAO,MAAM,WAAW,EAAE,YAAY,EAgMrC,CAAC"}
@@ -0,0 +1,7 @@
1
+ import { CardPluginOptions, ExtractedMetadata } from './types.js';
2
+ import { PluginContext } from '../../types.js';
3
+ /**
4
+ * Fetch HTML content and extract metadata using rule-based system
5
+ */
6
+ export declare const fetchMetadata: (url: string, options: CardPluginOptions, context: PluginContext) => Promise<ExtractedMetadata>;
7
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/fetcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACvE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;GAEG;AACH,eAAO,MAAM,aAAa,GACxB,KAAK,MAAM,EACX,SAAS,iBAAiB,EAC1B,SAAS,aAAa,KACrB,OAAO,CAAC,iBAAiB,CA8C3B,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { ExtractedMetadata, CardPluginOptions } from './types.js';
2
+ /**
3
+ * Generate fallback HTML for when OGP data cannot be fetched
4
+ */
5
+ export declare const generateFallbackHtml: (url: string, errorInfo?: string) => string;
6
+ /**
7
+ * Generate HTML card from extracted metadata
8
+ */
9
+ export declare const generateCardHtml: (data: ExtractedMetadata, originalUrl: string, options?: CardPluginOptions) => string;
10
+ //# sourceMappingURL=html-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-generator.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/html-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAEvE;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,EAAE,YAAY,MAAM,KAAG,MAoCtE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAAI,MAAM,iBAAiB,EAAE,aAAa,MAAM,EAAE,UAAS,iBAAsB,KAAG,MA0OhH,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { CardPluginOptions } from './types.js';
2
+ import { Plugin } from '../../types.js';
3
+ export { amazonRules } from './amazon-rules.js';
4
+ /**
5
+ * Create a card plugin instance for generating content cards from URLs
6
+ * @param options - Configuration options for the card plugin
7
+ * @returns Plugin instance for processing card blocks
8
+ */
9
+ export declare const createCardPlugin: (options?: CardPluginOptions) => Plugin;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AACpD,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAG5D,OAAO,EAAE,WAAW,EAAE,MAAM,mBAAmB,CAAC;AAEhD;;;;GAIG;AACH,eAAO,MAAM,gBAAgB,GAAI,UAAS,iBAAsB,KAAG,MAmClE,CAAC"}
@@ -0,0 +1,25 @@
1
+ import { ScrapingRule } from './types.js';
2
+ /**
3
+ * OGP (Open Graph Protocol) scraping rules for general fallback
4
+ * These rules are applied to any site as a last resort fallback
5
+ *
6
+ * IMPORTANT: Twitter Card metadata is included in this fallback strategy because:
7
+ *
8
+ * 1. WIDESPREAD ADOPTION: Twitter Card meta tags are used by 53.7% of websites (W3Techs)
9
+ * including major sites like Google, Microsoft, Apple, YouTube, LinkedIn, Amazon, GitHub
10
+ *
11
+ * 2. OFFICIAL RECOMMENDATION: Twitter/X officially recommends using Twitter Card metadata
12
+ * alongside OGP, with Twitter's parser falling back to OGP when Twitter-specific
13
+ * properties are not present
14
+ *
15
+ * 3. CROSS-PLATFORM USAGE: Twitter Card metadata is not Twitter-exclusive - it's
16
+ * referenced by LinkedIn, Facebook, Pinterest, SEO tools, and CMS platforms
17
+ *
18
+ * 4. DE FACTO STANDARD: Twitter Card has become a web standard for rich social sharing,
19
+ * making it appropriate for general OGP fallback rules rather than site-specific rules
20
+ *
21
+ * 5. OPTIMAL FALLBACK CHAIN: OGP → Twitter Card → HTML elements provides comprehensive
22
+ * coverage for social media sharing across all platforms
23
+ */
24
+ export declare const ogpRules: ScrapingRule[];
25
+ //# sourceMappingURL=ogp-rules.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"ogp-rules.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/ogp-rules.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,eAAO,MAAM,QAAQ,EAAE,YAAY,EA2MlC,CAAC"}
@@ -0,0 +1,12 @@
1
+ import { ScrapingRule, ExtractedMetadata } from './types.js';
2
+ import { Logger } from '../../types.js';
3
+ import * as cheerio from 'cheerio';
4
+ /**
5
+ * Apply scraping rule to extract metadata
6
+ */
7
+ export declare const applyScrapingRule: (rule: ScrapingRule, $: ReturnType<typeof cheerio.load>, url: string, logger?: Logger) => ExtractedMetadata;
8
+ /**
9
+ * Find matching scraping rule for URL
10
+ */
11
+ export declare const findMatchingRule: (rules: ScrapingRule[], url: string, logger?: Logger) => ScrapingRule | undefined;
12
+ //# sourceMappingURL=rule-engine.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"rule-engine.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/rule-engine.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AACnC,OAAO,KAAK,EAAE,YAAY,EAA4E,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC5I,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AA6O7C;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,YAAY,EAClB,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,EAClC,KAAK,MAAM,EACX,SAAS,MAAM,KACd,iBAgEF,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,gBAAgB,GAC3B,OAAO,YAAY,EAAE,EACrB,KAAK,MAAM,EACX,SAAS,MAAM,KACd,YAAY,GAAG,SA+BjB,CAAC"}
@@ -0,0 +1,99 @@
1
+ /**
2
+ * Card plugin display fields configuration
3
+ *
4
+ * Maps field names to their display order (lower numbers appear first).
5
+ * Fields with undefined order are not displayed.
6
+ * Fields not defined in this config but present in metadata will be
7
+ * displayed after all defined fields in an unstable order.
8
+ */
9
+ export type CardPluginDisplayFields = Record<string, number>;
10
+ /**
11
+ * Card plugin options
12
+ */
13
+ export interface CardPluginOptions {
14
+ /** Whether to use metadata URL (from fetched/canonical URL) for links instead of provided URL (default: false) */
15
+ useMetadataUrlLink?: boolean;
16
+ /** Control which metadata fields to display in the generated HTML */
17
+ displayFields?: CardPluginDisplayFields;
18
+ /** Custom scraping rules to apply before OGP fallback rules (OGP rules are always appended) */
19
+ scrapingRules?: ScrapingRule[];
20
+ }
21
+ /**
22
+ * Rule-based scraping system types
23
+ */
24
+ /**
25
+ * Processor context passed to processor functions
26
+ */
27
+ export interface ProcessorContext {
28
+ /** Cheerio instance for the current page */
29
+ $: ReturnType<typeof import('cheerio').load>;
30
+ /** Cheerio instance for the HTML head section */
31
+ $head: ReturnType<typeof import('cheerio').load>;
32
+ /** Current URL being processed */
33
+ url: string;
34
+ /** Locale information (from rule or extracted from META tags) */
35
+ locale?: string;
36
+ }
37
+ /**
38
+ * Declarative processor rule for common transformations
39
+ */
40
+ export interface ProcessorRule {
41
+ /** Type of processing to apply */
42
+ type: 'regex' | 'filter' | 'slice' | 'first' | 'currency';
43
+ /** Parameters for the processor */
44
+ params?: any;
45
+ }
46
+ /**
47
+ * Function-based processor for complex logic
48
+ */
49
+ export interface ProcessorFunction {
50
+ (values: string[], context: ProcessorContext): string | string[] | undefined;
51
+ }
52
+ /**
53
+ * Processor can be either a rule or a function
54
+ */
55
+ export type Processor = ProcessorRule | ProcessorFunction;
56
+ /**
57
+ * Field extraction rule
58
+ */
59
+ export interface FieldRule {
60
+ /** CSS selector(s) to extract data */
61
+ selector: string | string[];
62
+ /** Extraction method */
63
+ method?: 'text' | 'attr' | 'html';
64
+ /** Attribute name for 'attr' method */
65
+ attr?: string;
66
+ /** Whether to extract multiple elements */
67
+ multiple?: boolean;
68
+ /** Post-processing logic */
69
+ processor?: Processor;
70
+ }
71
+ /**
72
+ * Field configuration with multiple extraction strategies
73
+ */
74
+ export interface FieldConfig {
75
+ /** Whether this field is required for the rule to be considered successful */
76
+ required?: boolean;
77
+ /** Array of extraction rules to try in order (first successful match is used) */
78
+ rules: FieldRule[];
79
+ }
80
+ /**
81
+ * Site-specific scraping rule
82
+ */
83
+ export interface ScrapingRule {
84
+ /** Regex pattern to match URLs */
85
+ pattern: string;
86
+ /** Locale/region identifier (optional, if not specified, extracted from META tags) */
87
+ locale?: string;
88
+ /** Site name (automatically added to metadata as 'siteName') */
89
+ siteName?: string;
90
+ /** Field extraction configurations */
91
+ fields: {
92
+ [key: string]: FieldConfig;
93
+ };
94
+ }
95
+ /**
96
+ * Extracted metadata result
97
+ */
98
+ export type ExtractedMetadata = Record<string, string | string[]>;
99
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/types.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AACH,MAAM,MAAM,uBAAuB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;AAE7D;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,kHAAkH;IAClH,kBAAkB,CAAC,EAAE,OAAO,CAAC;IAC7B,qEAAqE;IACrE,aAAa,CAAC,EAAE,uBAAuB,CAAC;IACxC,+FAA+F;IAC/F,aAAa,CAAC,EAAE,YAAY,EAAE,CAAC;CAChC;AAED;;GAEG;AAEH;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,4CAA4C;IAC5C,CAAC,EAAE,UAAU,CAAC,cAAc,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7C,iDAAiD;IACjD,KAAK,EAAE,UAAU,CAAC,cAAc,SAAS,EAAE,IAAI,CAAC,CAAC;IACjD,kCAAkC;IAClC,GAAG,EAAE,MAAM,CAAC;IACZ,iEAAiE;IACjE,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB;AAED;;GAEG;AACH,MAAM,WAAW,aAAa;IAC5B,kCAAkC;IAClC,IAAI,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,GAAG,OAAO,GAAG,UAAU,CAAC;IAC1D,mCAAmC;IAEnC,MAAM,CAAC,EAAE,GAAG,CAAC;CACd;AAED;;GAEG;AACH,MAAM,WAAW,iBAAiB;IAChC,CAAC,MAAM,EAAE,MAAM,EAAE,EAAE,OAAO,EAAE,gBAAgB,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;CAC9E;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,aAAa,GAAG,iBAAiB,CAAC;AAE1D;;GAEG;AACH,MAAM,WAAW,SAAS;IACxB,sCAAsC;IACtC,QAAQ,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;IAC5B,wBAAwB;IACxB,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,GAAG,MAAM,CAAC;IAClC,uCAAuC;IACvC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,2CAA2C;IAC3C,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,4BAA4B;IAC5B,SAAS,CAAC,EAAE,SAAS,CAAC;CACvB;AAED;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B,8EAA8E;IAC9E,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,iFAAiF;IACjF,KAAK,EAAE,SAAS,EAAE,CAAC;CACpB;AAED;;GAEG;AACH,MAAM,WAAW,YAAY;IAC3B,kCAAkC;IAClC,OAAO,EAAE,MAAM,CAAC;IAChB,sFAAsF;IACtF,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,gEAAgE;IAChE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,sCAAsC;IACtC,MAAM,EAAE;QACN,CAAC,GAAG,EAAE,MAAM,GAAG,WAAW,CAAC;KAC5B,CAAC;CACH;AAED;;GAEG;AACH,MAAM,MAAM,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import { ExtractedMetadata, ScrapingRule } from './types.js';
2
+ import { Logger } from '../../types.js';
3
+ import * as cheerio from 'cheerio';
4
+ /**
5
+ * Validate URL format
6
+ */
7
+ export declare const isValidUrl: (url: string) => boolean;
8
+ /**
9
+ * Escape HTML characters
10
+ */
11
+ export declare const escapeHtml: (text: string) => string;
12
+ /**
13
+ * Extract domain from URL
14
+ */
15
+ export declare const extractDomain: (url: string) => string;
16
+ /**
17
+ * Resolve relative URLs to absolute URLs
18
+ */
19
+ export declare const resolveUrl: (url: string, baseUrl: string) => string;
20
+ /**
21
+ * Truncate text to specified length with ellipsis
22
+ */
23
+ export declare const truncateText: (text: string, maxLength: number) => string;
24
+ /**
25
+ * Clean and normalize text content
26
+ */
27
+ export declare const cleanText: (text: string) => string;
28
+ /**
29
+ * Extract enhanced scraping data for supported sites using rule engine
30
+ */
31
+ export declare const extractEnhancedData: ($: ReturnType<typeof cheerio.load>, sourceUrl: string, customRules?: ScrapingRule[], logger?: Logger) => ExtractedMetadata | null;
32
+ //# sourceMappingURL=utils.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.ts","sourceRoot":"","sources":["../../../src/plugins/card/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,OAAO,MAAM,SAAS,CAAC;AAGnC,OAAO,KAAK,EAAE,iBAAiB,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAClE,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,KAAG,OAOxC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,MAAM,MAAM,KAAG,MASzC,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,aAAa,GAAI,KAAK,MAAM,KAAG,MAO3C,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,UAAU,GAAI,KAAK,MAAM,EAAE,SAAS,MAAM,KAAG,MAkBzD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,MAAM,EAAE,WAAW,MAAM,KAAG,MAK9D,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,SAAS,GAAI,MAAM,MAAM,KAAG,MAKxC,CAAC;AAWF;;GAEG;AACH,eAAO,MAAM,mBAAmB,GAC9B,GAAG,UAAU,CAAC,OAAO,OAAO,CAAC,IAAI,CAAC,EAClC,WAAW,MAAM,EACjB,cAAc,YAAY,EAAE,EAC5B,SAAS,MAAM,KACd,iBAAiB,GAAG,IA+BtB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export * from './card/index.js';
2
+ //# sourceMappingURL=card-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"card-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/card-plugin.ts"],"names":[],"mappings":"AACA,cAAc,iBAAiB,CAAC"}
@@ -0,0 +1,9 @@
1
+ import { MermaidPluginOptions } from './types.js';
2
+ import { Plugin } from '../../types.js';
3
+ /**
4
+ * Create a mermaid plugin instance for rendering mermaid diagrams
5
+ * @param options - Configuration options for the mermaid plugin
6
+ * @returns Plugin instance for processing mermaid blocks
7
+ */
8
+ export declare const createMermaidPlugin: (options?: MermaidPluginOptions) => Plugin;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/mermaid/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,oBAAoB,EAAE,MAAM,YAAY,CAAC;AACvD,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAE5D;;;;GAIG;AACH,eAAO,MAAM,mBAAmB,GAAI,UAAS,oBAAyB,KAAG,MAqExE,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Options for configuring the mermaid plugin
3
+ */
4
+ export interface MermaidPluginOptions {
5
+ /** Custom CSS class name for the mermaid container (default: 'mermaid') */
6
+ className?: string;
7
+ /** Whether to include ID attributes for containers (default: true) */
8
+ includeId?: boolean;
9
+ }
10
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/plugins/mermaid/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AACH,MAAM,WAAW,oBAAoB;IACnC,2EAA2E;IAC3E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,sEAAsE;IACtE,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB"}
@@ -0,0 +1,2 @@
1
+ export * from './mermaid/index.js';
2
+ //# sourceMappingURL=mermaid-plugin.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mermaid-plugin.d.ts","sourceRoot":"","sources":["../../src/plugins/mermaid-plugin.ts"],"names":[],"mappings":"AACA,cAAc,oBAAoB,CAAC"}
@@ -0,0 +1,13 @@
1
+ import { OEmbedResponse, OEmbedProvider } from './types.js';
2
+ import { PluginContext } from '../../types.js';
3
+ /**
4
+ * Custom error class to indicate CORS failure
5
+ */
6
+ export declare class CORSError extends Error {
7
+ constructor(message: string);
8
+ }
9
+ /**
10
+ * Fetch oEmbed data from provider
11
+ */
12
+ export declare const fetchOEmbedData: (url: string, maxRedirects: number, timeoutEachRedirect: number, context: PluginContext, providers: OEmbedProvider[]) => Promise<OEmbedResponse>;
13
+ //# sourceMappingURL=fetcher.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fetcher.d.ts","sourceRoot":"","sources":["../../../src/plugins/oembed/fetcher.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;GAEG;AACH,qBAAa,SAAU,SAAQ,KAAK;gBACtB,OAAO,EAAE,MAAM;CAI5B;AAED;;GAEG;AACH,eAAO,MAAM,eAAe,GAC1B,KAAK,MAAM,EACX,cAAc,MAAM,EACpB,qBAAqB,MAAM,EAC3B,SAAS,aAAa,EACtB,WAAW,cAAc,EAAE,KAC1B,OAAO,CAAC,cAAc,CAuCxB,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { OEmbedResponse, OEmbedPluginOptions } from './types.js';
2
+ /**
3
+ * Generate fallback HTML for unsupported providers
4
+ */
5
+ export declare const generateFallbackHtml: (url: string, errorInfo?: string) => string;
6
+ /**
7
+ * Generate HTML from oEmbed response data
8
+ */
9
+ export declare const generateHtml: (data: OEmbedResponse, originalUrl: string, options?: OEmbedPluginOptions) => string;
10
+ //# sourceMappingURL=html-generator.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"html-generator.d.ts","sourceRoot":"","sources":["../../../src/plugins/oembed/html-generator.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,mBAAmB,EAAE,MAAM,YAAY,CAAC;AAEtE;;GAEG;AACH,eAAO,MAAM,oBAAoB,GAAI,KAAK,MAAM,EAAE,YAAY,MAAM,KAAG,MAiBtE,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,GAAI,MAAM,cAAc,EAAE,aAAa,MAAM,EAAE,UAAS,mBAAwB,KAAG,MA+B3G,CAAC"}
@@ -0,0 +1,10 @@
1
+ import { OEmbedPluginOptions, OEmbedProvider } from './types.js';
2
+ import { Plugin } from '../../types.js';
3
+ /**
4
+ * Create an oEmbed plugin instance for embedding rich content from supported providers
5
+ * @param providerList - List of oEmbed providers to use
6
+ * @param options - Configuration options for the oEmbed plugin
7
+ * @returns Plugin instance for processing oEmbed blocks
8
+ */
9
+ export declare const createOEmbedPlugin: (providerList: OEmbedProvider[], options?: OEmbedPluginOptions) => Plugin;
10
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/plugins/oembed/index.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,mBAAmB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACtE,OAAO,KAAK,EAAE,MAAM,EAAiB,MAAM,gBAAgB,CAAC;AAE5D;;;;;GAKG;AACH,eAAO,MAAM,kBAAkB,GAAI,cAAc,cAAc,EAAE,EAAE,UAAS,mBAAwB,KAAG,MAoCtG,CAAC"}
@@ -0,0 +1,26 @@
1
+ import { OEmbedProvider } from './types.js';
2
+ import { PluginContext } from '../../types.js';
3
+ /**
4
+ * Default providers from downloaded providers.json
5
+ * Downloaded from https://oembed.com/providers.json
6
+ *
7
+ * Export this if you want to use the built-in provider list,
8
+ * or provide your own custom providers to buildProvidersCache.
9
+ */
10
+ export declare const defaultProviderList: OEmbedProvider[];
11
+ /**
12
+ * Build a cache mapping schemes to oEmbed endpoints
13
+ * @param param0 - Plugin context containing logger
14
+ * @param providers - List of oEmbed providers
15
+ * @returns Promise resolving to a Map of schemes to endpoint URLs
16
+ */
17
+ export declare const buildProvidersCache: ({ logger }: PluginContext, providers: OEmbedProvider[]) => Promise<Map<string, string>>;
18
+ /**
19
+ * Find oEmbed endpoint URL for a given content URL
20
+ * @param url - Content URL to find oEmbed endpoint for
21
+ * @param providersCache - Cache of provider schemes to endpoints
22
+ * @param param2 - Plugin context containing logger, signal, and fetcher
23
+ * @returns Promise resolving to the oEmbed endpoint URL
24
+ */
25
+ export declare const getOEmbedUrl: (url: string, providersCache: Map<string, string>, { logger, signal, fetcher }: PluginContext) => Promise<string>;
26
+ //# sourceMappingURL=providers.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"providers.d.ts","sourceRoot":"","sources":["../../../src/plugins/oembed/providers.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AACjD,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAAE,cAAc,EAAgD,CAAC;AAuCjG;;;;;GAKG;AACH,eAAO,MAAM,mBAAmB,GAC9B,YAAY,aAAa,EACzB,WAAW,cAAc,EAAE,KAC1B,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,CAkB7B,CAAC;AAEF;;;;;;GAMG;AACH,eAAO,MAAM,YAAY,GACvB,KAAK,MAAM,EACX,gBAAgB,GAAG,CAAC,MAAM,EAAE,MAAM,CAAC,EACnC,6BAA6B,aAAa,KACzC,OAAO,CAAC,MAAM,CA4ChB,CAAC"}