build: add precompiled CLI distribution
This commit is contained in:
@@ -0,0 +1,15 @@
|
||||
const deckBase = (import.meta as ImportMeta & { env: { BASE_URL: string } }).env.BASE_URL
|
||||
|
||||
export function resolveImageSource(source: string | undefined, base = deckBase) {
|
||||
if (!source || isAbsoluteSource(source))
|
||||
return source
|
||||
|
||||
const normalizedBase = base.endsWith('/') ? base : `${base}/`
|
||||
return `${normalizedBase}${source.replace(/^\.\//, '')}`
|
||||
}
|
||||
|
||||
function isAbsoluteSource(source: string) {
|
||||
return source.startsWith('/')
|
||||
|| source.startsWith('#')
|
||||
|| /^[a-z][a-z\d+.-]*:/i.test(source)
|
||||
}
|
||||
Reference in New Issue
Block a user