MCPcopy Index your code
hub / github.com/markmap/markmap / inlineAssets

Function inlineAssets

packages/markmap-cli/src/index.ts:35–66  ·  view source on GitHub ↗
(assets: IAssets)

Source from the content-addressed store, hash-verified

33}
34
35async 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
68export async function createMarkmap(
69 options: IMarkmapCreateOptions & IDevelopOptions & { open: boolean },

Callers 1

createMarkmapFunction · 0.85

Calls 1

loadFileFunction · 0.85

Tested by

no test coverage detected