(assets: IAssets)
| 33 | } |
| 34 | |
| 35 | async function inlineAssets(assets: IAssets): Promise<IAssets> { |
| 36 | const [scripts, styles] = await Promise.all([ |
| 37 | Promise.all( |
| 38 | (assets.scripts || []).map( |
| 39 | async (item): Promise<JSItem> => |
| 40 | item.type === 'script' && item.data.src |
| 41 | ? { |
| 42 | type: 'script', |
| 43 | data: { |
| 44 | textContent: await loadFile(item.data.src), |
| 45 | }, |
| 46 | } |
| 47 | : item, |
| 48 | ), |
| 49 | ), |
| 50 | Promise.all( |
| 51 | (assets.styles || []).map( |
| 52 | async (item): Promise<CSSItem> => |
| 53 | item.type === 'stylesheet' |
| 54 | ? { |
| 55 | type: 'style', |
| 56 | data: await loadFile(item.data.href), |
| 57 | } |
| 58 | : item, |
| 59 | ), |
| 60 | ), |
| 61 | ]); |
| 62 | return { |
| 63 | scripts, |
| 64 | styles, |
| 65 | }; |
| 66 | } |
| 67 | |
| 68 | export async function createMarkmap( |
| 69 | options: IMarkmapCreateOptions & IDevelopOptions & { open: boolean }, |
no test coverage detected