src/index.js
function packageReqFromBundle(mId) {
  const possibleIds = nodejsIds(mId);
  const bundleName = Object.keys(_bundles).find(bn =>
    possibleIds.some(d => {
      const pack = _bundles[bn].package;
      if (pack.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 pack.hasOwnProperty(p.bareId);
    })
  );

  if (bundleName) {
    return loadBundle(bundleName)
    .then(() => {
      if (packageSpace.has(mId)) return packageSpace.req(mId);
      const tried = tryPlugin(mId, packageSpace);
      if (tried) return tried;
      throw new Error(`module "${mId}" is missing from bundle "${bundleName}"`);
    });
  }

  const err = new Error(`no bundle for module "${mId}"`);
  err.__unkown = mId;
  throw err;
}
function packageReqFromBundle(mId) {
  const possibleIds = nodejsIds(mId);
  const bundleName = Object.keys(_bundles).find(bn =>
    possibleIds.some(d => {
      const pack = _bundles[bn].package;
      if (pack.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 pack.hasOwnProperty(p.bareId);
    })
  );

  if (bundleName) {
    return loadBundle(bundleName)
    .then(() => {
      if (packageSpace.has(mId)) return packageSpace.req(mId);
      const tried = tryPlugin(mId, packageSpace);
      if (tried) return tried;
      throw new Error(`module "${mId}" is missing from bundle "${bundleName}"`);
    });
  }

  const err = new Error(`no bundle for module "${mId}"`);
  err.__unkown = mId;
  throw err;
}
function packageReqFromBundle ( mId ) { const possibleIds = nodejsIds ( mId ) ; const bundleName = Object . keys ( _bundles ) . find ( bn => possibleIds . some ( d => { const pack = _bundles [ bn ] . package ; if ( pack . 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 pack . hasOwnProperty ( p . bareId ) ; } ) ) ; if ( bundleName ) { return loadBundle ( bundleName ) . then ( ( ) => { if ( packageSpace . has ( mId ) ) return packageSpace . req ( mId ) ; const tried = tryPlugin ( mId , packageSpace ) ; if ( tried ) return tried ; throw new Error ( ` ${ mId } ${ bundleName } ` ) ; } ) ; } const err = new Error ( ` ${ mId } ` ) ; err . __unkown = mId ; throw err ; }
incoming id is already mapped return a promise to load additional bundle or throw an error to help userSpaceTesseract to identify sync return.
incoming id is already mapped return a promise to load additional bundle or throw an error to help userSpaceTesseract to identify sync return .