MCPcopy Create free account
hub / github.com/cujojs/poly / fixAndPushPaths

Function fixAndPushPaths

test/curl.js:376–416  ·  view source on GitHub ↗
(coll, isPkg)

Source from the content-addressed store, hash-verified

374 // the global cfg.pathMap or on a plugin-specific altCfg.pathMap.
375 // also populates a pathList on cfg or plugin configs.
376 function fixAndPushPaths (coll, isPkg) {
377 var id, pluginId, data, parts, pluginCfg, info;
378 for (var name in coll) {
379 data = coll[name];
380 pluginCfg = cfg;
381 // grab the package id, if specified. default to
382 // property name.
383 parts = pluginParts(removeEndSlash(data['id'] || data['name'] || name));
384 id = parts.resourceId;
385 pluginId = parts.pluginId;
386 if (pluginId) {
387 // plugin-specific path
388 pluginCfg = pluginCfgs[pluginId];
389 if (!pluginCfg) {
390 pluginCfg = pluginCfgs[pluginId] = beget(cfg);
391 pluginCfg.pathMap = beget(cfg.pathMap);
392 pluginCfg.pathList = [];
393 }
394 // remove plugin-specific path from coll
395 delete coll[name];
396 }
397 if (isPkg) {
398 info = normalizePkgDescriptor(data);
399 }
400 else {
401 info = { path: removeEndSlash(data) };
402 }
403 info.specificity = id.split('/').length;
404// info.specificity = (id.match(findSlashRx) || []).length;
405 if (id) {
406 pluginCfg.pathMap[id] = info;
407 pluginCfg.pathList.push(id);
408 }
409 else {
410 // naked plugin name signifies baseUrl for plugin
411 // resources. baseUrl could be relative to global
412 // baseUrl.
413 pluginCfg.baseUrl = core.resolveUrl(data, cfg);
414 }
415 }
416 }
417
418 // adds the path matching regexp onto the cfg or plugin cfgs.
419 function convertPathMatcher (cfg) {

Callers 1

curl.jsFile · 0.85

Calls 4

pluginPartsFunction · 0.85
removeEndSlashFunction · 0.85
begetFunction · 0.85
normalizePkgDescriptorFunction · 0.85

Tested by

no test coverage detected