"use strict";

var _reactDocgen = _interopRequireDefault(require("react-docgen"));

var _path = _interopRequireDefault(require("path"));

var _utils = require("../utils");

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

// import loaderUtils from 'loader-utils';
module.exports = source => {
  (void 0).cacheable && (void 0).cacheable(); // let query = loaderUtils.parseQuery(this.query);

  let value = {};

  try {
    value = _reactDocgen.default.parse(source);
  } catch (e) {
    (0, _utils.log)('ERROR in docgen-loader', e);
  }

  let comNameAry = (void 0).resourcePath.split(_path.default.sep);
  let comName = comNameAry[comNameAry.length - 1];
  let name = comName.substring(0, comName.lastIndexOf('.'));
  return `${source};${name}.propsObj=${JSON.stringify(value)}`;
};