MCPcopy Index your code
hub / github.com/OpenCoworkAI/open-codesign / stripHostJsxRuntimeScripts

Function stripHostJsxRuntimeScripts

packages/runtime/src/index.ts:444–456  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

442}
443
444function stripHostJsxRuntimeScripts(html: string): string {
445 return transformHtmlElementBlocks(html, 'script', ({ attrs, tag }) => {
446 const rawSrc = getHtmlAttribute(attrs, 'src');
447 if (rawSrc === null) return tag;
448 let url: URL;
449 try {
450 url = new URL(rawSrc);
451 } catch {
452 return tag;
453 }
454 return isKnownHostJsxRuntimePath(url.pathname) ? '' : tag;
455 });
456}
457
458function isKnownHostJsxRuntimePath(path: string): boolean {
459 const parts = path.toLowerCase().split('/').filter(Boolean);

Callers 2

injectJsxRuntimeIntoHtmlFunction · 0.85

Calls 3

getHtmlAttributeFunction · 0.90

Tested by

no test coverage detected