import { randomUUID } from "crypto"
import { JSX } from "preact/jsx-runtime"
export type JSResource = {
loadTime: 'beforeDOMReady' | 'afterDOMReady'
moduleType?: 'module',
spaPreserve?: boolean
} & ({
src: string
contentType: 'external'
} | {
script: string
contentType: 'inline'
})
export function JSResourceToScriptElement(resource: JSResource, preserve?: boolean): JSX.Element {
const scriptType = resource.moduleType ?? 'application/javascript'
const spaPreserve = preserve ?? resource.spaPreserve
if (resource.contentType === 'external') {
return
} else {
const content = resource.script
return
}
}
export interface StaticResources {
css: string[],
js: JSResource[]
}