tasks/generate-index.js
function getImport(symbol, member) {
  const defaultExport = symbol.name.split('~');
  const namedExport = symbol.name.split('.');
  if (defaultExport.length > 1) {
    const from = defaultExport[0].replace(/^module\:/, './');
    const importName = from.replace(/[.\/]+/g, '$');
    return `import ${importName} from '${from}';`;
  } else if (namedExport.length > 1 && member) {
    const from = namedExport[0].replace(/^module\:/, './');
    const importName = from.replace(/[.\/]+/g, '_');
    return `import {${member} as ${importName}$${member}} from '${from}';`;
  }
}
function getImport(symbol, member) {
  const defaultExport = symbol.name.split('~');
  const namedExport = symbol.name.split('.');
  if (defaultExport.length > 1) {
    const from = defaultExport[0].replace(/^module\:/, './');
    const importName = from.replace(/[.\/]+/g, '$');
    return `import ${importName} from '${from}';`;
  } else if (namedExport.length > 1 && member) {
    const from = namedExport[0].replace(/^module\:/, './');
    const importName = from.replace(/[.\/]+/g, '_');
    return `import {${member} as ${importName}$${member}} from '${from}';`;
  }
}
function getImport ( symbol , member ) { const defaultExport = symbol . name . split ( '~' ) ; const namedExport = symbol . name . split ( '.' ) ; if ( defaultExport . length > 1 ) { const from = defaultExport [ 0 ] . replace ( / ^module\: / , './' ) ; const importName = from . replace ( / [.\/]+ / g , '$' ) ; return ` ${ importName } ${ from } ` ; } else if ( namedExport . length > 1 && member ) { const from = namedExport [ 0 ] . replace ( / ^module\: / , './' ) ; const importName = from . replace ( / [.\/]+ / g , '_' ) ; return ` ${ member } ${ importName } ${ member } ${ from } ` ; } }
Generate an import statement.
@param {Object} symbol Symbol.
@param {string} member Member.
@return {string} An import statement.
Generate an import statement .