(
src: TrustedScriptURL | string
)
| 248 | new Map() |
| 249 | |
| 250 | function maybeExecuteScript( |
| 251 | src: TrustedScriptURL | string |
| 252 | ): Promise<unknown> { |
| 253 | // With HMR we might need to "reload" scripts when they are |
| 254 | // disposed and readded. Executing scripts twice has no functional |
| 255 | // differences |
| 256 | if (process.env.NODE_ENV !== 'development') { |
| 257 | let prom: Promise<unknown> | undefined = loadedScripts.get(src.toString()) |
| 258 | if (prom) { |
| 259 | return prom |
| 260 | } |
| 261 | |
| 262 | // Skip executing script if it's already in the DOM: |
| 263 | if (document.querySelector(`script[src^="${src}"]`)) { |
| 264 | return Promise.resolve() |
| 265 | } |
| 266 | |
| 267 | loadedScripts.set(src.toString(), (prom = appendScript(src))) |
| 268 | return prom |
| 269 | } else { |
| 270 | return appendScript(src) |
| 271 | } |
| 272 | } |
| 273 | |
| 274 | function fetchStyleSheet(href: string): Promise<RouteStyleSheet> { |
| 275 | let prom: Promise<RouteStyleSheet> | undefined = styleSheets.get(href) |
nothing calls this directly
no test coverage detected