(matches: Array<AnyRouteMatch>)
| 36 | } |
| 37 | |
| 38 | const getScripts = (matches: Array<AnyRouteMatch>): Array<RouterManagedTag> => |
| 39 | ( |
| 40 | matches |
| 41 | .map((match) => match.scripts!) |
| 42 | .flat(1) |
| 43 | .filter(Boolean) as Array<RouterManagedTag> |
| 44 | ).map( |
| 45 | ({ children, ...script }) => |
| 46 | ({ |
| 47 | tag: 'script', |
| 48 | attrs: { |
| 49 | ...script, |
| 50 | nonce, |
| 51 | }, |
| 52 | children, |
| 53 | }) satisfies RouterManagedTag, |
| 54 | ) |
| 55 | |
| 56 | const activeMatches = Solid.createMemo(() => router.stores.matches.get()) |
| 57 | const assetScripts = Solid.createMemo(() => getAssetScripts(activeMatches())) |