mirror of
https://github.com/heygen-com/hyperframes.git
synced 2026-11-11 19:09:20 +00:00
* feat(core): a composition's script can load its own files with __hyperframes.assetUrl * test(core): a template composition inside a mounted file resolves assets from that file * docs: assetUrl is for paths beside the composition, not project-root paths * docs: say assetUrl misses a project-root path
9 lines
397 B
TypeScript
9 lines
397 B
TypeScript
/**
|
|
* Resolves a path the calling composition wrote relative to its own file. At the top level, and
|
|
* for a composition opened on its own, that file is the page. Inside a mounted sub-composition
|
|
* the scoped wrapper (compiler/compositionScoping.ts) replaces this with one bound to that file.
|
|
*/
|
|
export function assetUrl(path: string): string {
|
|
return new URL(path, document.baseURI).href;
|
|
}
|