MCPcopy
hub / github.com/meteor/meteor / add

Method add

tools/isobuild/bundler.js:366–415  ·  view source on GitHub ↗
(moreInfo, path)

Source from the content-addressed store, hash-verified

364 const nodeModulesDirectories = Object.create(null);
365
366 function add(moreInfo, path) {
367 const info = {
368 ...callerInfo,
369 ...moreInfo,
370 };
371
372 if (! info.packageName) {
373 const parts = path.split("/");
374
375 if (parts[0] === "npm" &&
376 parts[1] === "node_modules" &&
377 parts[2] === "meteor") {
378 info.packageName = parts[3];
379
380 } else if (parts.length === 3 &&
381 parts[0] === "npm" &&
382 parts[2] === "node_modules") {
383 info.packageName = parts[1];
384
385 } else {
386 parts.some(function (part, i) {
387 if (i > 0 && part === ".npm") {
388 if (parts[i + 1] === "package") {
389 info.packageName = parts[i - 1];
390 return true;
391 }
392
393 if (parts[i + 1] === "plugin") {
394 info.packageName = parts[i + 2];
395 return true;
396 }
397 }
398 });
399 }
400
401 if (! info.packageName) {
402 throw new Error("No package name inferred from " + path);
403 }
404 }
405
406 if (files.pathIsAbsolute(path)) {
407 info.sourcePath = path;
408 } else {
409 rejectBadPath(path);
410 info.sourcePath = files.pathJoin(callerInfo.sourceRoot, path);
411 }
412
413 nodeModulesDirectories[info.sourcePath] =
414 new NodeModulesDirectory(info);
415 }
416
417 if (typeof node_modules === "string") {
418 // Old-style node_modules strings were only ever for

Callers 15

printPackageFunction · 0.80
_emitResourcesMethod · 0.80
resolveMethod · 0.80
a.jsFile · 0.80
b.jsFile · 0.80
main.jsFile · 0.80
e.jsFile · 0.80

Calls 1

rejectBadPathFunction · 0.70

Tested by

no test coverage detected