lib/module.js
function get_mod (parsed) {
  var id = parsed.id;

  // id -> '@kael/a@1.1.0/b'
  return mods[id] || (mods[id] = {
    // package scope:
    s: parsed.s,
    // package name: 'a'
    n: parsed.n,
    // package version: '1.1.0'
    v: parsed.v,
    // module path: '/b'
    p: parsed.p,
    // module id: 'a@1.1.0/b'
    id: id,
    // package id: 'a@1.1.0'
    k: parsed.k,
    // version map of the current module
    m: {},
    // loading queue
    l: [],
    // If there is no path, it must be a main entry.
    // Actually, there will always be a path when defining a module,
    // but `get_mod` method is called when a module has been required,
    // and not loaded and defined.
    // When we `require('foo')`, `foo` must be a main module of a package.
    main: !parsed.p
    // map: {Object} The map of aliases to real module id
  });
}
function get_mod (parsed) {
  var id = parsed.id;

  // id -> '@kael/a@1.1.0/b'
  return mods[id] || (mods[id] = {
    // package scope:
    s: parsed.s,
    // package name: 'a'
    n: parsed.n,
    // package version: '1.1.0'
    v: parsed.v,
    // module path: '/b'
    p: parsed.p,
    // module id: 'a@1.1.0/b'
    id: id,
    // package id: 'a@1.1.0'
    k: parsed.k,
    // version map of the current module
    m: {},
    // loading queue
    l: [],
    // If there is no path, it must be a main entry.
    // Actually, there will always be a path when defining a module,
    // but `get_mod` method is called when a module has been required,
    // and not loaded and defined.
    // When we `require('foo')`, `foo` must be a main module of a package.
    main: !parsed.p
    // map: {Object} The map of aliases to real module id
  });
}
function get_mod ( parsed ) { var id = parsed . id ; // id -> '@kael/a@1.1.0/b' return mods [ id ] || ( mods [ id ] = { // package scope: s : parsed . s , // package name: 'a' n : parsed . n , // package version: '1.1.0' v : parsed . v , // module path: '/b' p : parsed . p , // module id: 'a@1.1.0/b' id : id , // package id: 'a@1.1.0' k : parsed . k , // version map of the current module m : { } , // loading queue l : [ ] , // If there is no path, it must be a main entry. // Actually, there will always be a path when defining a module, // but `get_mod` method is called when a module has been required, // and not loaded and defined. // When we `require('foo')`, `foo` must be a main module of a package. main : ! parsed . p // map: {Object} The map of aliases to real module id } ) ; }
Create a mod
Create a mod