| 9 | const nonce = router.options.ssr?.nonce |
| 10 | |
| 11 | const getAssetScripts = (matches: Array<AnyRouteMatch>) => { |
| 12 | const assetScripts: Array<RouterManagedTag> = [] |
| 13 | const manifest = router.ssr?.manifest |
| 14 | |
| 15 | if (!manifest) { |
| 16 | return [] |
| 17 | } |
| 18 | |
| 19 | for (const match of matches) { |
| 20 | const scripts = manifest.routes[match.routeId]?.scripts |
| 21 | |
| 22 | if (!scripts) { |
| 23 | continue |
| 24 | } |
| 25 | |
| 26 | for (const asset of scripts) { |
| 27 | assetScripts.push({ |
| 28 | tag: 'script', |
| 29 | attrs: { ...asset.attrs, nonce }, |
| 30 | children: asset.children, |
| 31 | }) |
| 32 | } |
| 33 | } |
| 34 | |
| 35 | return assetScripts |
| 36 | } |
| 37 | |
| 38 | const getScripts = (matches: Array<AnyRouteMatch>): Array<RouterManagedTag> => |
| 39 | ( |