MCPcopy Create free account
hub / github.com/heygen-com/hyperframes / hoistExternalScript

Function hoistExternalScript

packages/core/src/compiler/htmlBundler.ts:635–653  ·  view source on GitHub ↗
(
  src: string,
  projectDir: string,
  doc: Document,
  seenSrcs: Set<string>,
  chunks: string[],
)

Source from the content-addressed store, hash-verified

633}
634
635function hoistExternalScript(
636 src: string,
637 projectDir: string,
638 doc: Document,
639 seenSrcs: Set<string>,
640 chunks: string[],
641): void {
642 if (seenSrcs.has(src)) return;
643 seenSrcs.add(src);
644 if (!isNonRelativeUrl(src) && !isAbsolute(src)) {
645 const jsPath = resolveWithinProject(projectDir, src);
646 const js = jsPath ? safeReadFile(jsPath) : null;
647 if (js != null) {
648 chunks.push(js);
649 return;
650 }
651 }
652 ensureExternalScriptTag(doc, src);
653}
654
655function hoistCompositionScripts(
656 container: { querySelectorAll: (sel: string) => NodeListOf<Element> },

Callers 1

hoistCompositionScriptsFunction · 0.85

Calls 5

isNonRelativeUrlFunction · 0.85
resolveWithinProjectFunction · 0.85
safeReadFileFunction · 0.85
ensureExternalScriptTagFunction · 0.85
addMethod · 0.80

Tested by

no test coverage detected