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

Method getAssets

packages/markmap-lib/src/transform.ts:98–112  ·  view source on GitHub ↗

* Get all assets from enabled plugins or filter them by plugin names as keys.

(keys?: string[])

Source from the content-addressed store, hash-verified

96 * Get all assets from enabled plugins or filter them by plugin names as keys.
97 */
98 getAssets(keys?: string[]): IAssets {
99 const styles: CSSItem[] = [];
100 const scripts: JSItem[] = [];
101 keys ??= this.plugins.map((plugin) => plugin.name);
102 for (const assets of keys.map((key) => this.assetsMap[key])) {
103 if (assets) {
104 if (assets.styles) styles.push(...assets.styles);
105 if (assets.scripts) scripts.push(...assets.scripts);
106 }
107 }
108 return {
109 styles: styles.map((item) => this.resolveCSS(item)),
110 scripts: scripts.map((item) => this.resolveJS(item)),
111 };
112 }
113
114 /**
115 * Get used assets by features object returned by `transform`.

Callers 5

getUsedAssetsMethod · 0.95
fetchAssetsFunction · 0.95
index.test.tsFile · 0.80
transformFunction · 0.80
_buildHtmlMethod · 0.80

Calls 2

resolveCSSMethod · 0.95
resolveJSMethod · 0.95

Tested by

no test coverage detected