@ecency/render-helper 2.5.34 → 2.5.35
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/dist/browser/index.d.ts +12 -1
- package/dist/browser/index.js +21 -1
- package/dist/browser/index.js.map +1 -1
- package/dist/node/index.cjs +21 -0
- package/dist/node/index.cjs.map +1 -1
- package/dist/node/index.mjs +21 -1
- package/dist/node/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/browser/index.d.ts
CHANGED
|
@@ -75,6 +75,17 @@ declare function markdown2Html(obj: Entry | string, forApp?: boolean, _webp?: bo
|
|
|
75
75
|
* URL). Returns null when the fast path finds no unambiguous image (the caller
|
|
76
76
|
* can fall back to catchPostImage).
|
|
77
77
|
*/
|
|
78
|
+
/**
|
|
79
|
+
* The RAW (pre-proxify) URL of the image a CARD renders.
|
|
80
|
+
*
|
|
81
|
+
* Mirrors catchPostImage's precedence — `json_metadata.thumbnails` first, then
|
|
82
|
+
* `json_metadata.image`, then the first body image — which is NOT the order
|
|
83
|
+
* getEntryImageRawUrl uses: that one answers a body/LCP-preload question and
|
|
84
|
+
* deliberately skips thumbnails. Use this when a caller has to reason about the
|
|
85
|
+
* file the card will actually request (its extension, say), or it can end up
|
|
86
|
+
* inspecting one asset while the card renders another.
|
|
87
|
+
*/
|
|
88
|
+
declare function getEntryCardImageRawUrl(obj: Entry | string): string | null;
|
|
78
89
|
declare function getEntryImageRawUrl(obj: Entry | string): string | null;
|
|
79
90
|
interface CatchPostImageOptions {
|
|
80
91
|
/**
|
|
@@ -200,4 +211,4 @@ declare function isValidPermlink(permlink: string): boolean;
|
|
|
200
211
|
*/
|
|
201
212
|
declare function simpleMarkdownToHTML(input: string): string;
|
|
202
213
|
|
|
203
|
-
export { type Entry, IMAGE_SIZES, type ProxifyOptions, type RenderOptions, SECTION_LIST, type SeoContext, buildPictureSources, buildSrcSet, buildSrcSetForFormat, catchPostImage, getEntryImageRawUrl, isAllowedEmbedSrc, isLegacySizedProxyUrl, isPictureEligibleRawUrl, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, setSlowRenderThresholdMs, simpleMarkdownToHTML };
|
|
214
|
+
export { type Entry, IMAGE_SIZES, type ProxifyOptions, type RenderOptions, SECTION_LIST, type SeoContext, buildPictureSources, buildSrcSet, buildSrcSetForFormat, catchPostImage, getEntryCardImageRawUrl, getEntryImageRawUrl, isAllowedEmbedSrc, isLegacySizedProxyUrl, isPictureEligibleRawUrl, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, setSlowRenderThresholdMs, simpleMarkdownToHTML };
|
package/dist/browser/index.js
CHANGED
|
@@ -2785,6 +2785,26 @@ function getImage(entry, width = 0, height = 0, format = "match", fastMode = fal
|
|
|
2785
2785
|
}
|
|
2786
2786
|
return null;
|
|
2787
2787
|
}
|
|
2788
|
+
function getEntryCardImageRawUrl(obj) {
|
|
2789
|
+
if (typeof obj === "string") {
|
|
2790
|
+
return getEntryImageRawUrl(obj);
|
|
2791
|
+
}
|
|
2792
|
+
let meta;
|
|
2793
|
+
if (typeof obj.json_metadata === "object") {
|
|
2794
|
+
meta = obj.json_metadata;
|
|
2795
|
+
} else {
|
|
2796
|
+
try {
|
|
2797
|
+
meta = JSON.parse(obj.json_metadata);
|
|
2798
|
+
} catch (e) {
|
|
2799
|
+
meta = null;
|
|
2800
|
+
}
|
|
2801
|
+
}
|
|
2802
|
+
const thumbnail = firstMetaUrl(meta?.thumbnails);
|
|
2803
|
+
if (thumbnail) {
|
|
2804
|
+
return decodeImageSrc(thumbnail);
|
|
2805
|
+
}
|
|
2806
|
+
return getEntryImageRawUrl(obj);
|
|
2807
|
+
}
|
|
2788
2808
|
function getEntryImageRawUrl(obj) {
|
|
2789
2809
|
if (typeof obj === "string") {
|
|
2790
2810
|
const src = findFirstImageUrl(obj, true);
|
|
@@ -2934,6 +2954,6 @@ function getPostBodySummary(obj, length, platform) {
|
|
|
2934
2954
|
return res;
|
|
2935
2955
|
}
|
|
2936
2956
|
|
|
2937
|
-
export { IMAGE_SIZES, SECTION_LIST, buildPictureSources, buildSrcSet, buildSrcSetForFormat, catchPostImage, getEntryImageRawUrl, isAllowedEmbedSrc, isLegacySizedProxyUrl, isPictureEligibleRawUrl, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, setSlowRenderThresholdMs, simpleMarkdownToHTML };
|
|
2957
|
+
export { IMAGE_SIZES, SECTION_LIST, buildPictureSources, buildSrcSet, buildSrcSetForFormat, catchPostImage, getEntryCardImageRawUrl, getEntryImageRawUrl, isAllowedEmbedSrc, isLegacySizedProxyUrl, isPictureEligibleRawUrl, isValidPermlink, getPostBodySummary as postBodySummary, proxifyImageSrc, markdown2Html as renderPostBody, setCacheSize, setProxyBase, setSlowRenderThresholdMs, simpleMarkdownToHTML };
|
|
2938
2958
|
//# sourceMappingURL=index.js.map
|
|
2939
2959
|
//# sourceMappingURL=index.js.map
|