MCPcopy Index your code
hub / github.com/violentmonkey/violentmonkey / buildPathMap

Function buildPathMap

src/background/utils/db.js:711–727  ·  view source on GitHub ↗

@return {Object}

(script, base)

Source from the content-addressed store, hash-verified

709
710/** @return {Object} */
711function buildPathMap(script, base) {
712 const { meta } = script;
713 const baseUrl = base || script.custom.lastInstallURL;
714 const pathMap = baseUrl ? [
715 ...meta.require,
716 ...Object.values(meta.resources),
717 meta.icon,
718 ].reduce((map, key) => {
719 if (key) {
720 const fullUrl = vetUrl(key, baseUrl);
721 if (fullUrl !== key) map[key] = fullUrl;
722 }
723 return map;
724 }, {}) : {};
725 script.custom.pathMap = pathMap;
726 return pathMap;
727}
728
729/**
730 * @param {VMScript} script

Callers 3

getScriptsByURLFunction · 0.85
parseScriptFunction · 0.85
vacuumFunction · 0.85

Calls 1

vetUrlFunction · 0.90

Tested by

no test coverage detected