MCPcopy Create free account
hub / github.com/arktypeio/arktype / scriptsOf

Function scriptsOf

ark/aot/unplugin.ts:2778–2787  ·  view source on GitHub ↗
(html: string)

Source from the content-addressed store, hash-verified

2776
2777// imports of a page's module scripts, or undefined where one is inline
2778const scriptsOf = (html: string): string | undefined => {
2779 const imports: string[] = []
2780 for (const [tag] of html.matchAll(/<script\b[^>]*>/gi)) {
2781 if (!/\btype\s*=\s*["']?module\b/i.test(tag)) continue
2782 const src = /\bsrc\s*=\s*(?:"([^"]*)"|'([^']*)'|([^\s>]+))/i.exec(tag)
2783 if (!src) return
2784 imports.push(`import ${JSON.stringify(src[1] ?? src[2] ?? src[3])}`)
2785 }
2786 return imports.join("\n")
2787}
2788
2789const rollupImportsOf = (
2790 context: RollupContext,

Callers 2

rollupEntriesOfFunction · 0.85
rollupUnseenOfFunction · 0.85

Calls 3

testMethod · 0.80
execMethod · 0.80
pushMethod · 0.45

Tested by

no test coverage detected