diff --git a/bun.lockb b/bun.lockb index fe1e5c7..670577f 100755 Binary files a/bun.lockb and b/bun.lockb differ diff --git a/package.json b/package.json index bb186f2..6ceaf47 100644 --- a/package.json +++ b/package.json @@ -18,6 +18,6 @@ "algoliasearch": "^4.23.2", "bun-tracestrings": "github:oven-sh/bun.report", "gray-matter": "^4.0.3", - "lilybird": "^0.6.0" + "lilybird": "^0.6.1" } } diff --git a/src/util.ts b/src/util.ts index 0ba30e6..aa34613 100644 --- a/src/util.ts +++ b/src/util.ts @@ -1,6 +1,6 @@ import { GuildMember } from "@lilybird/transformers"; import { BUN_EMOJIS } from "./constants.ts"; -import { parse, formatMarkdown } from "bun-tracestrings"; +import { parseAndRemap, formatMarkdown } from "bun-tracestrings"; const URL_REGEX = /\(\s*(https?:\/\/[^\s\[\]]+)\s*\)/gi; @@ -53,22 +53,11 @@ export function sliceIfStartsWith(input: string, startsWith: string) { export async function getBunReportDetailsInMarkdown( url: string ): Promise { - const parsed = await parse(url); + const remap = await parseAndRemap(url); + if (!Array.isArray(remap.features)) remap.features = []; // temporary fix - const res = await fetch("https://bun.report/remap", { - method: "POST", - body: url, - }); - - if (!res.ok) { - return `Failed to get details from bun.report: ${res.statusText}`; - } - - const json = await res.json(); - - let content = formatMarkdown({ - ...parsed, - ...json, + let content = formatMarkdown(remap, { + source: url, }); for (const match of content.matchAll(URL_REGEX)) {