src/index.js
function userReqFromBundle(mId) {
  const possibleIds = nodejsIds(mId);
  const bundleName = Object.keys(_bundles).find(bn => {
    const {nameSpace, user} = _bundles[bn];
    return possibleIds.some(d => {
      if (nameSpace) {
        const parsed = parse(d);
        if (parsed.bareId.slice(0, nameSpace.length + 1) === nameSpace + '/') {
          d = parsed.prefix + parsed.bareId.slice(nameSpace.length + 1);
        }
      }

      if (user.hasOwnProperty(d)) return true;
      const p = parse(d);
      // For module with unknown plugin prefix, try bareId.
      // This relies on dumber bundler's default behaviour, it write in bundle config
      // both 'foo.html' and 'text!foo.html'.
      if (p.prefix) return user.hasOwnProperty(p.bareId);
    });
  });

  if (bundleName) {
    return loadBundle(bundleName)
    .then(() => {
      if (userSpace.has(mId)) return userSpace.req(mId);
      // mId is not directly defined in the bundle, it could be
      // behind a customised plugin or ext plugin.
      const tried = tryPlugin(mId, userSpace);
      if (tried) return tried;
      throw new Error(`module "${mId}" is missing from bundle "${bundleName}"`);
    });
  }
}
function userReqFromBundle(mId) {
  const possibleIds = nodejsIds(mId);
  const bundleName = Object.keys(_bundles).find(bn => {
    const {nameSpace, user} = _bundles[bn];
    return possibleIds.some(d => {
      if (nameSpace) {
        const parsed = parse(d);
        if (parsed.bareId.slice(0, nameSpace.length + 1) === nameSpace + '/') {
          d = parsed.prefix + parsed.bareId.slice(nameSpace.length + 1);
        }
      }

      if (user.hasOwnProperty(d)) return true;
      const p = parse(d);
      // For module with unknown plugin prefix, try bareId.
      // This relies on dumber bundler's default behaviour, it write in bundle config
      // both 'foo.html' and 'text!foo.html'.
      if (p.prefix) return user.hasOwnProperty(p.bareId);
    });
  });

  if (bundleName) {
    return loadBundle(bundleName)
    .then(() => {
      if (userSpace.has(mId)) return userSpace.req(mId);
      // mId is not directly defined in the bundle, it could be
      // behind a customised plugin or ext plugin.
      const tried = tryPlugin(mId, userSpace);
      if (tried) return tried;
      throw new Error(`module "${mId}" is missing from bundle "${bundleName}"`);
    });
  }
}
function userReqFromBundle ( mId ) { const possibleIds = nodejsIds ( mId ) ; const bundleName = Object . keys ( _bundles ) . find ( bn => { const { nameSpace , user } = _bundles [ bn ] ; return possibleIds . some ( d => { if ( nameSpace ) { const parsed = parse ( d ) ; if ( parsed . bareId . slice ( 0 , nameSpace . length + 1 ) === nameSpace + '/' ) { d = parsed . prefix + parsed . bareId . slice ( nameSpace . length + 1 ) ; } } if ( user . hasOwnProperty ( d ) ) return true ; const p = parse ( d ) ; // For module with unknown plugin prefix, try bareId. // This relies on dumber bundler's default behaviour, it write in bundle config // both 'foo.html' and 'text!foo.html'. if ( p . prefix ) return user . hasOwnProperty ( p . bareId ) ; } ) ; } ) ; if ( bundleName ) { return loadBundle ( bundleName ) . then ( ( ) => { if ( userSpace . has ( mId ) ) return userSpace . req ( mId ) ; // mId is not directly defined in the bundle, it could be // behind a customised plugin or ext plugin. const tried = tryPlugin ( mId , userSpace ) ; if ( tried ) return tried ; throw new Error ( ` ${ mId } ${ bundleName } ` ) ; } ) ; } }
incoming id is already mapped return a promise to load additional bundle or return undefined.
incoming id is already mapped return a promise to load additional bundle or return undefined .