(content: string)
| 60 | * bundler share one grammar. |
| 61 | */ |
| 62 | export function extractEmbeddedFileRefs(content: string): { keys: string[]; ids: string[] } { |
| 63 | const keys = new Set<string>() |
| 64 | const ids = new Set<string>() |
| 65 | for (const match of content.matchAll(EMBED_URL_RE)) { |
| 66 | const ref = extractEmbeddedFileRef(match[0]) |
| 67 | if (!ref) continue |
| 68 | if ('key' in ref) keys.add(ref.key) |
| 69 | else ids.add(ref.fileId) |
| 70 | if (keys.size + ids.size >= MAX_EMBEDDED_IMAGES) break |
| 71 | } |
| 72 | return { keys: [...keys], ids: [...ids] } |
| 73 | } |
no test coverage detected