exports.ids = [3];
exports.modules = {

/***/ "./src/collection/index.js":
/***/ function(module, exports, __webpack_require__) {

"use strict";
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.PatternMapping = exports.Collection = undefined;

var _values = __webpack_require__(15);

var _values2 = _interopRequireDefault(_values);

var _promise = __webpack_require__(12);

var _promise2 = _interopRequireDefault(_promise);

var _toConsumableArray2 = __webpack_require__(4);

var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);

var _defineProperty2 = __webpack_require__(11);

var _defineProperty3 = _interopRequireDefault(_defineProperty2);

var _extends2 = __webpack_require__(0);

var _extends3 = _interopRequireDefault(_extends2);

var _classCallCheck2 = __webpack_require__(1);

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = __webpack_require__(2);

var _createClass3 = _interopRequireDefault(_createClass2);

exports.create = create;

var _lodash = __webpack_require__(6);

var _lodash2 = _interopRequireDefault(_lodash);

var _path = __webpack_require__(5);

var _pathIsAbsolute = __webpack_require__(19);

var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute);

var _skypagerUtil = __webpack_require__(3);

var _document = __webpack_require__("./src/document/index.js");

var _document2 = _interopRequireDefault(_document);

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

var compact = _lodash2.default.compact;
var set = _lodash2.default.set;
var groupBy = _lodash2.default.groupBy;
var snakeCase = _lodash2.default.snakeCase;
var uniq = _lodash2.default.uniq;
var chain = _lodash2.default.chain;
var mapValues = _lodash2.default.mapValues;
var values = _values2.default;

var Collection = exports.Collection = function () {
  (0, _createClass3.default)(Collection, null, [{
    key: 'mount',
    value: function mount(cwd) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      return create((0, _extends3.default)({
        cwd: cwd }, options)).imported.withDocuments;
    }

    /**
    * Create a collection which wraps a directory and creates a queryable index
    * of all of the files inside of it.  Files exist as VFile (@see https://github.com/wooorm/vfile) and are
    * wrapped by Document classes which provide the interface for metadata, transformations, and things of that nature.
    * A collection also provides a lodash wrapper interface for building extraction functions from the collections
    * files and data.
    *
    * @param {Object} options - the options hash
    * @param {String} options.type - the type of document - will determine which document model wrapper is used
    * @param {String} options.cwd - the root of the collection, defaults to process.cwd()
    * @param {String} options.cwd - the cwd, if different from the base
    * @param {Array} options.include - an array of glob patterns to include
    * @param {Array} options.exclude - an array of glob patterns to exclude
    * @param {Object} options.documentOptions - an object that will be passed to the document wrapper when created
    * @param {Object} options.importerOptions - an object that will be passed to the document importer when created
    */

  }]);

  function Collection() {
    var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
    (0, _classCallCheck3.default)(this, Collection);

    (0, _skypagerUtil.mixinPropertyUtils)(this);

    this.hide('cwd', options.cwd || options.root || options.base || options.basePath);
    this.hide('options', normalize(options));

    this.pathId = this.cwd.split('/').reverse().slice(0, 2).join('-');
    this.instanceId = this.pathId + '-' + Math.floor(Date.now() / 1000);

    this.hideGetter('collection', options.collection);
    this.hide('filesIndex', {});
    this.hide('documentsIndex', {});
    this.hide('project', options.project);
  }

  (0, _createClass3.default)(Collection, [{
    key: 'shouldRejectFile',
    value: function shouldRejectFile(file) {
      if (typeof this.options.rejectFile === 'function') {
        return this.options.rejectFile.call(this, file);
      }

      if (file.path.indexOf('/ios/') >= 0) {
        return true;
      }

      if (file.path.indexOf('/android/') >= 0) {
        return true;
      }

      return !file.path.startsWith(this.cwd);
    }
  }, {
    key: 'createDocuments',
    value: function createDocuments() {
      var _this = this;

      var documentOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      var Document = this.Document;

      _lodash2.default.mapValues(this.filesIndex, function (file, path) {
        path = (0, _path.relative)(_this.cwd, path);

        _this.documentsIndex[path] = _this.documentsIndex[path] || new Document(file, (0, _extends3.default)({}, _this.documentOptions, documentOptions, {
          project: _this.project,
          collection: _this
        }));
      });

      return this;
    }
  }, {
    key: 'isDirectory',
    value: function isDirectory(file) {
      var path = file.path ? file.path : file;

      return typeof file.isDirectory === 'function' ? file.isDirectory() : !path.match(/\.\w+$/);
    }
  }, {
    key: 'add',
    value: function add(file) {
      if (file.path && !this.isDirectory(file)) {
        _lodash2.default.assign(this.filesIndex, (0, _defineProperty3.default)({}, (0, _path.relative)(this.cwd, file.path), file));
      }
    }
  }, {
    key: 'indexFiles',
    value: function indexFiles() {
      var _this2 = this;

      var files = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : [];

      var cwd = this.cwd;

      files = _lodash2.default.chain(files).reject(function (f) {
        return _this2.isDirectory(f);
      }).reject(function (f) {
        return _this2.shouldRejectFile(f);
      }).compact().sortBy(function (f) {
        return f.path.length;
      }).keyBy(function (f) {
        return (0, _path.relative)(cwd, f.path);
      }).value();

      _lodash2.default.assign(this.filesIndex, (0, _extends3.default)({}, this.filesIndex, files));

      return this;
    }
  }, {
    key: 'loadFiles',
    value: function loadFiles() {
      var _this3 = this;

      return this.importer.fileWrappers.then(function (files) {
        return _this3.indexFiles(files.map(function (file) {
          return file.toVFile ? file.toVFile() : file;
        }));
      }).then(function (collection) {
        return collection.withDocuments;
      }).catch(function (error) {
        return error;
      });
    }
  }, {
    key: 'createRouter',
    value: function createRouter(name) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      if (options.getter) {
        options.pathsGetter = options.getter;
      }
      if (options.property) {
        options.pathProperty = options.property;
      }

      (0, _skypagerUtil.router)(this._routers, (0, _extends3.default)({
        routerProperty: name,
        pathsGetter: name,
        pathProperty: 'id'
      }, options, {
        host: this,
        matchesOnly: true
      }));
    }
  }, {
    key: 'createDelegators',
    value: function createDelegators(receiver) {
      var _this4 = this;

      for (var _len = arguments.length, propNames = Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) {
        propNames[_key - 1] = arguments[_key];
      }

      propNames.forEach(function (propName) {
        receiver.hideGetter(propName, function () {
          return _this4[propName];
        });
      });
    }
  }, {
    key: 'getFileByRelativePath',
    value: function getFileByRelativePath(relativeFilePath) {
      var index = this.filesIndex[relativeFilePath].index;

      return this.files[index];
    }
  }, {
    key: 'join',
    value: function join() {
      for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
        args[_key2] = arguments[_key2];
      }

      return _path.join.apply(undefined, [this.cwd].concat(args));
    }
  }, {
    key: 'relative',
    value: function relative() {
      for (var _len3 = arguments.length, args = Array(_len3), _key3 = 0; _key3 < _len3; _key3++) {
        args[_key3] = arguments[_key3];
      }

      return _path.relative.apply(undefined, [this.cwd].concat(args));
    }
  }, {
    key: 'resolve',
    value: function resolve() {
      for (var _len4 = arguments.length, args = Array(_len4), _key4 = 0; _key4 < _len4; _key4++) {
        args[_key4] = arguments[_key4];
      }

      return _path.resolve.apply(undefined, [this.cwd].concat(args));
    }
  }, {
    key: 'select',
    value: function select() {
      return this.selectChain.apply(this, arguments).value();
    }
  }, {
    key: 'selectChain',
    value: function selectChain() {
      var _chain;

      for (var _len5 = arguments.length, paths = Array(_len5), _key5 = 0; _key5 < _len5; _key5++) {
        paths[_key5] = arguments[_key5];
      }

      var set = function set(obj, path, val) {
        _lodash2.default.set(obj, path, val);
        return obj;
      };

      return (_chain = this.chain).at.apply(_chain, (0, _toConsumableArray3.default)(_lodash2.default.sortBy(paths, function (p) {
        return p.length;
      }))).map(function (value, index) {
        return [paths[index], value];
      }).reduce(function (memo, pair) {
        return set.apply(undefined, [memo].concat((0, _toConsumableArray3.default)(pair)));
      }, {});
    }
  }, {
    key: 'selectByObject',
    value: function selectByObject(pathObject) {
      var _chain2;

      var keys = keys(pathObject);
      var paths = values(pathObject);

      return (_chain2 = this.chain).at.apply(_chain2, (0, _toConsumableArray3.default)(paths)).reduce(function (memo, val, index) {
        return set(memo, keys[index], val);
      }, {}).value();
    }
  }, {
    key: 'findDocumentById',
    value: function findDocumentById(documentId) {
      return this.documents.find(function (doc) {
        return doc.id === documentId;
      });
    }
  }, {
    key: 'applyFilesRoute',
    value: function applyFilesRoute(pattern) {
      var path = route()(pattern);
      var results = this.files.map(function (f) {
        return { path: f.relative, pathData: path(f.relative) };
      }).filter(function (f) {
        return f.pathData;
      });

      return {
        results: results,
        pattern: pattern
      };
    }
  }, {
    key: 'gitInfo',
    get: function get() {
      try {
        return __webpack_require__("./src/git/index.js")(this.cwd);
      } catch (error) {
        return {};
      }
    }
  }, {
    key: 'importer',
    get: function get() {
      return new this.Importer(this.cwd, (0, _extends3.default)({}, this.importerOptions, { patterns: this.patterns
      }));
    }
  }, {
    key: 'type',
    get: function get() {
      return snakeCase(this.options.type || 'Project').replace(/s$/i, '');
    }
  }, {
    key: 'files',
    get: function get() {
      return _lodash2.default.chain(this.filesIndex).values().compact().sortBy(function (d) {
        return d.path;
      }).value();
    }
  }, {
    key: 'documents',
    get: function get() {
      return _lodash2.default.chain(this.documentsIndex).values().compact().sortBy(function (d) {
        return d.file.path;
      }).value();
    }
  }, {
    key: 'documentClass',
    get: function get() {
      return this.options.documentClass || _document2.default;
    }
  }, {
    key: 'importerOptions',
    get: function get() {
      var c = this;

      return (0, _extends3.default)({}, c.options.importerOptions, {
        patterns: _lodash2.default.uniq([].concat((0, _toConsumableArray3.default)(c.patterns || []), (0, _toConsumableArray3.default)(c.options.importerOptions.patterns || [])))
      });
    }
  }, {
    key: 'documentOptions',
    get: function get() {
      var collection = this;

      return (0, _extends3.default)({
        cwd: collection.cwd,
        collectionType: collection.type
      }, collection.options.documentOptions || {});
    }
  }, {
    key: 'Document',
    get: function get() {
      return this.documentClass;
    }
  }, {
    key: 'withDocuments',
    get: function get() {
      this.createDocuments();
      return this;
    }
  }, {
    key: 'loaderPrefix',
    get: function get() {
      return this.get('options.loaderPrefix', '');
    }
  }, {
    key: 'documentEntryPoints',
    get: function get() {
      var _this5 = this;

      return this.chain.get('documents').keyBy('id').mapValues(function (doc) {
        return ['' + _this5.loaderPrefix + doc.file.path];
      }).mapValues(function (array) {
        return compact(array);
      }).value();
    }
  }, {
    key: 'documentsMappedById',
    get: function get() {
      return this.chain.get('documents').keyBy('id').value();
    }
  }, {
    key: 'documentsMap',
    get: function get() {
      return this.documentsIndex;
    }
  }, {
    key: 'Importer',
    get: function get() {
      return this.options.importer ? __webpack_require__(38)("./" + this.options.importer + '.js') : __webpack_require__("./src/importers/node-vinyl.js").DocumentImporter;
    }
  }, {
    key: 'patterns',
    get: function get() {
      return _lodash2.default.uniq(this.includePatterns.concat(this.excludePatterns));
    }
  }, {
    key: 'includePatterns',
    get: function get() {
      return _lodash2.default.uniq(this.options.include.concat(this.typePatterns));
    }
  }, {
    key: 'typePatterns',
    get: function get() {
      switch (this.type.toUpperCase()) {
        case PACKAGE:
          return PatternMapping.Package;
          break;
        case SCRIPT:
          return PatternMapping.Script;
          break;
        case (SETTINGS_FILE, COPY_FILE):
          return PatternMapping.SettingsFile;
          break;
        case DOCUMENT:
          return PatternMapping.Document;
          break;
        case STYLESHEET:
          return PatternMapping.Stylesheet;
          break;
        case VECTOR:
          return PatternMapping.Vector;
          break;
        case PROJECT:
        default:
          return PatternMapping.Project;
      }
    }
  }, {
    key: 'router',
    get: function get() {
      return this.routers.documents;
    }
  }, {
    key: 'routers',
    get: function get() {
      if (!this._routers) {
        this.hide('_routers', {});

        this.createRouter('files', {
          pathProperty: 'relative'
        });

        this.createRouter('documents', {
          pathProperty: 'baseRelativePath',
          pathsGetter: 'documents'
        });

        this.createRouter('folders', {
          pathProperty: 'toString',
          pathsGetter: 'subFolderNames'
        });
      }

      return mapValues(this._routers, function (router) {
        return router.get.bind(router);
      });
    }
  }, {
    key: 'chain',
    get: function get() {
      return chain(this);
    }
  }, {
    key: 'relativeObjectPaths',
    get: function get() {
      var _this6 = this;

      return this.chain.get('files').sortBy(function (f) {
        return f.dirname.length;
      }).map(function (f) {
        return [_this6.relative(f.dirname).replace(/\//g, '.'), f.basename, f.relative];
      }).groupBy(function (i) {
        return i.shift();
      }).value();
    }
  }, {
    key: 'subFolderObjectPaths',
    get: function get() {
      return this.chain.get('subFolderNames').sortBy(function (v) {
        return v.length;
      }).map(function (p) {
        return p.replace(/\//g, '.');
      }).value();
    }
  }, {
    key: 'excludePatterns',
    get: function get() {
      if (this.options.includeAll || this.options.exclude === false) {
        return [];
      }

      return this.options.exclude
      // HACK tmp
      .concat(this.project ? this.project.skypagerIgnoreContents || [] : []).map(function (p) {
        return p.startsWith('!') ? p : '!' + p;
      }).concat(['!**/node_modules/**', '*.xcodeproj', '!_*']);
    }
  }, {
    key: 'imported',
    get: function get() {
      if (this.files.length === 0) {
        this.indexFiles(this.importer.readFilesSync(false));
      }

      return this;
    }
  }, {
    key: 'rootFiles',
    get: function get() {
      return this.chains.files.filter(function (f) {
        return f.dirname === project.root;
      }).value();
    }
  }, {
    key: 'groupedByChildFolder',
    get: function get() {
      var _this7 = this;

      return this.chains.files.groupBy(function (f) {
        return _this7.relative(f.dirname).split('/').shift();
      }).pickBy(function (v, k) {
        return k.length > 0;
      }).value();
    }
  }, {
    key: 'groupedByChildFolderAndExtension',
    get: function get() {
      var _this8 = this;

      return this.chains.files.groupBy(function (f) {
        return _this8.relative(f.dirname).split('/').shift();
      }).mapValues(function (v) {
        return groupBy(v, function (v) {
          return v.extname;
        });
      }).pickBy(function (v, k) {
        return k.length > 0;
      }).value();
    }
  }, {
    key: 'chains',
    get: function get() {
      return {
        documents: chain(this.documents),
        files: chain(this.files)
      };
    }
  }, {
    key: 'query',
    get: function get() {
      var collection = this;

      return {
        get files() {
          return _skypagerUtil.query.bind(_skypagerUtil.query, collection.files);
        },
        get documents() {
          return _skypagerUtil.query.bind(_skypagerUtil.query, collection.documents);
        }
      };
    }
  }, {
    key: 'depths',
    get: function get() {
      var _this9 = this;

      return this.chains.files.map(function (f) {
        return _this9.relative(f.dirname);
      }).uniq().groupBy(function (f) {
        return f.split(_path.sep).length - 1;
      }).omit('').value();
    }
  }, {
    key: 'relativeFilePaths',
    get: function get() {
      var _this10 = this;

      return this.files.map(function (file) {
        return (0, _path.relative)(_this10.cwd, file.path);
      });
    }
  }, {
    key: 'relativeSubFolderPaths',
    get: function get() {
      var _this11 = this;

      return this.files.map(function (file) {
        return (0, _path.relative)(_this11.cwd, file.dirname);
      });
    }
  }, {
    key: 'subFolderPaths',
    get: function get() {
      return uniq(this.files.map(function (f) {
        return f.dirname;
      }));
    }
  }, {
    key: 'subFolderNames',
    get: function get() {
      var _this12 = this;

      return this.subFolderPaths.map(function (f) {
        return (0, _path.relative)(_this12.cwd, f);
      }).filter(function (f) {
        return f.length > 0;
      });
    }
  }, {
    key: 'subFolderBasenames',
    get: function get() {
      var _this13 = this;

      return this.subFolderPaths.map(function (f) {
        return (0, _path.relative)(_this13.cwd, f);
      }).map(function (f) {
        return (0, _path.basename)(f);
      });
    }
  }, {
    key: 'childFolderNames',
    get: function get() {
      return uniq(this.subFolderNames.map(function (p) {
        return p.split('/').shift();
      }));
    }
  }, {
    key: 'childFolderPaths',
    get: function get() {
      var _this14 = this;

      return uniq(this.childFolderNames.map(function (p) {
        return _this14.join(p);
      }));
    }
  }, {
    key: 'ready',
    get: function get() {
      var _this15 = this;

      return this.importer.status === 'LOADED' ? _promise2.default.resolve(this) : this.loadFiles().then(function () {
        return _this15;
      });
    }
  }], [{
    key: 'create',
    value: function create() {
      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
      var ready = arguments[1];

      var collection = new Collection(options);

      return typeof ready === 'function' ? ready(collection, Collection) : collection;
    }
  }, {
    key: 'Document',
    get: function get() {
      return _document2.default;
    }
  }]);
  return Collection;
}();

exports.default = Collection;


var PACKAGE = 'PACKAGE';
var SCRIPT = 'SCRIPT';
var DOCUMENT = 'DOCUMENT';
var SETTINGS_FILE = 'SETTINGS_FILE';
var COPY_FILE = 'COPY_FILE';
var PROJECT = 'PROJECT';
var VECTOR = 'VECTOR';
var STYLESHEET = 'STYLESHEET';

var PatternMapping = exports.PatternMapping = {
  'Package': ['**/package.json'],
  'Document': ['**/*.md'],
  'Script': ['**/*.js', '**/*.jsx'],
  'Stylesheet': ['**/*.{css,less,sass,scss,styl'],
  'SettingsFile': ['**/*.yml'],
  'CopyFile': ['**/*.yml'],
  'Vector': ['**/*.svg'],
  'DataSource': ['**/*.json', '**/*.yml', '**/*.data.js'],
  'Project': ['**/*']
};

function create() {
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

  return Collection.create(options);
}

function normalize() {
  var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

  return (0, _extends3.default)({}, options, {
    importerOptions: options.importerOptions || {},
    documentOptions: options.documentOptions || {},
    include: [].concat((0, _toConsumableArray3.default)(options.include || []), (0, _toConsumableArray3.default)(options.patterns || [])),
    exclude: [].concat((0, _toConsumableArray3.default)(options.exclude || []), (0, _toConsumableArray3.default)(options.ignore || []))
  });
}

/***/ },

/***/ "./src/document/index.js":
/***/ function(module, exports, __webpack_require__) {

"use strict";
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.Document = exports.patterns = exports.DefaultPatterns = undefined;

var _values = __webpack_require__(15);

var _values2 = _interopRequireDefault(_values);

var _extends2 = __webpack_require__(0);

var _extends3 = _interopRequireDefault(_extends2);

var _classCallCheck2 = __webpack_require__(1);

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = __webpack_require__(2);

var _createClass3 = _interopRequireDefault(_createClass2);

var _class, _temp;

exports.normalizeUri = normalizeUri;

var _url = __webpack_require__(52);

var _url2 = _interopRequireDefault(_url);

var _path = __webpack_require__(5);

var _skypagerUtil = __webpack_require__(3);

var _pathIsAbsolute = __webpack_require__(19);

var _pathIsAbsolute2 = _interopRequireDefault(_pathIsAbsolute);

var _collection = __webpack_require__("./src/collection/index.js");

var _collection2 = _interopRequireDefault(_collection);

var _mapValues = __webpack_require__(20);

var _mapValues2 = _interopRequireDefault(_mapValues);

var _isFunction = __webpack_require__(34);

var _isFunction2 = _interopRequireDefault(_isFunction);

var _vfile = __webpack_require__(53);

var _vfile2 = _interopRequireDefault(_vfile);

var _get = __webpack_require__(16);

var _get2 = _interopRequireDefault(_get);

var _result = __webpack_require__(32);

var _result2 = _interopRequireDefault(_result);

var _set = __webpack_require__(33);

var _set2 = _interopRequireDefault(_set);

var _omit = __webpack_require__(29);

var _omit2 = _interopRequireDefault(_omit);

var _pick = __webpack_require__(35);

var _pick2 = _interopRequireDefault(_pick);

var _uniq = __webpack_require__(18);

var _uniq2 = _interopRequireDefault(_uniq);

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

var DefaultPatterns = exports.DefaultPatterns = ['**/*.{js,md,yml,json,svg,html,css,scss,less,json}', '!node_modules/**'];

var patterns = exports.patterns = DefaultPatterns;

var Document = exports.Document = (_temp = _class = function () {
  (0, _createClass3.default)(Document, null, [{
    key: 'mountCollection',
    value: function mountCollection() {
      var cwd = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : process.cwd();
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      return _collection2.default.mount(cwd, options);
    }
  }]);

  function Document(vFileOrPath) {
    var _this = this;

    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck3.default)(this, Document);

    (0, _skypagerUtil.mixinPropertyUtils)(this);

    var originalURI = normalizeUri(vFileOrPath.path ? vFileOrPath.path : vFileOrPath, options.cwd || process.cwd());

    if (options.project) {
      this.hide('project', options.project);
      delete options.project;
    }

    if (options.collection) {
      this.hide('collection', options.collection);
      delete options.collection;
    }

    this.hide('options', options);
    this.hide('cwd', options.cwd);
    this.hide('originalURI', originalURI);
    this.hide('parsedURI', _url2.default.parse(this.originalURI));
    this.hide('url', this.parsedURI.href);
    this.hide('uri', this.url);
    this.hide('path', unescape(this.parsedURI.path));

    if (vFileOrPath.path) {
      this.options.file = vFileOrPath;
    }

    this.lazy('file', function () {
      return _this.toVFile((0, _extends3.default)({
        cwd: _this.cwd
      }, _this.options.file || {}));
    });

    this.hide('data', {});
    this.lazy('id', this.buildId.bind(this));
  }

  (0, _createClass3.default)(Document, [{
    key: 'getTransformPresets',
    value: function getTransformPresets() {
      return this.matchingDocTypes.reduce(function (memo, docType) {
        return (0, _extends3.default)({}, memo, docType.getTransforms ? docType.getTransforms() : {});
      });
    }
  }, {
    key: 'getTransforms',
    value: function getTransforms() {
      return this.matchingDocTypes.reduce(function (memo, docType) {
        return (0, _extends3.default)({}, memo, docType.getTransforms ? docType.getTransforms() : {});
      });
    }
  }, {
    key: 'getUtils',
    value: function getUtils() {
      return this.matchingDocTypes.reduce(function (memo, docType) {
        return (0, _extends3.default)({}, memo, docType.getUtils ? docType.getUtils() : {});
      });
    }
  }, {
    key: 'buildId',
    value: function buildId() {
      if ((0, _isFunction2.default)(this.options.buildId)) {
        return this.options.buildId((0, _path.relative)(this.cwd, this.path));
      } else if (this.collection && (0, _isFunction2.default)(this.collection.buildId)) {
        return this.collection.buildId((0, _path.relative)(this.cwd, this.path));
      } else {
        return (0, _path.relative)(this.cwd, this.path).replace(/\.\w+$/g, '').replace(/\.js$/g, '');
      }
    }
  }, {
    key: 'applyDoctypes',
    value: function applyDoctypes() {
      var _this2 = this;

      this.matchingDocTypes.forEach(function (docType) {
        docType.decorate(_this2);
      });

      return this;
    }
  }, {
    key: 'toJson',
    value: function toJson() {
      var options = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      return (0, _extends3.default)({
        id: this.id,
        file: (0, _omit2.default)(this.file, 'contents', '_contents'),
        metadata: this.metadata,
        idParts: this.idParts,
        categoryFolder: this.categoryFolder,
        categoryFolderName: this.categoryFolderName,
        baseFolder: this.baseFolder,
        variations: this.variations
      }, options.pick ? (0, _pick2.default)(this, options.pick) : {}, options.pickBy ? pickBy(this, options.pickBy) : {}, options.includeContents ? { contents: this.file.contents } : {});
    }
  }, {
    key: 'toVFile',
    value: function toVFile() {
      var fileOptions = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};

      return (0, _vfile2.default)((0, _extends3.default)({
        path: this.path
      }, fileOptions));
    }
  }, {
    key: 'readFile',
    value: function readFile() {
      var cache = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true;

      this.file.contents = cache && this.contents ? this.contents : this.project.readFileSync(this.file.path).toString();

      return this;
    }
  }, {
    key: 'readFileAsync',
    value: function readFileAsync() {
      var _this3 = this;

      return this.project.readFileAsync(this.file.path).then(function (contents) {
        return _this3.contents = contents.toString();
      });
    }
  }, {
    key: 'createStemVariations',
    value: function createStemVariations() {
      var base = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.variationsBase;
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
      var startCase = _skypagerUtil.strings.startCase;
      var camelCase = _skypagerUtil.strings.camelCase;
      var kebabCase = _skypagerUtil.strings.kebabCase;
      var snakeCase = _skypagerUtil.strings.snakeCase;


      return (0, _mapValues2.default)({
        classified: startCase(camelCase(base)).replace(/\s+/g, ''),
        camel: camelCase(base),
        kebab: kebabCase(base),
        snake: snakeCase(base),
        underscored: kebabCase(base).replace(/\-/g, '_')
      }, function (v) {
        var value = '' + (options.prefix || '') + v + (options.suffix || '');
        var modifier = options.pluralize ? _skypagerUtil.strings.pluralize : options.singularize ? _skypagerUtil.strings.singularize : function (v) {
          return v;
        };

        return modifier(value);
      });
    }
  }, {
    key: 'getFileContents',
    value: function getFileContents() {
      return this.get('file.contents', '').toString();
    }
  }, {
    key: 'decorated',
    get: function get() {
      this.applyDoctypes();
      return this;
    }
  }, {
    key: 'chain',
    get: function get() {
      return this.project.chain.plant(this);
    }
  }, {
    key: 'exporter',
    get: function get() {
      return this.project.chain.plant(this.ready);
    }
  }, {
    key: 'ready',
    get: function get() {
      return this.readFile().decorated;
    }
  }, {
    key: 'doctypes',
    get: function get() {
      return this.docTypes;
    }
  }, {
    key: 'docTypes',
    get: function get() {
      var project = this.project;


      return project.chain.get('documentTypes.available').thru(function (list) {
        return list.map(function (docType) {
          return project.documentType(docType);
        });
      }).value();
    }
  }, {
    key: 'matchingDocTypes',
    get: function get() {
      var _this4 = this;

      var project = this.project;


      return project.chain.get('documentTypes.available').thru(function (list) {
        return list.map(function (docType) {
          return project.documentType(docType);
        });
      }).flatten().filter(function (docType) {
        return docType.testDocument(_this4);
      }).value();
    }
  }, {
    key: 'idParts',
    get: function get() {
      return this.id.split('/');
    }
  }, {
    key: 'baseFolder',
    get: function get() {
      return this.idParts[0];
    }
  }, {
    key: 'categoryFolderName',
    get: function get() {
      return this.idParts[1];
    }
  }, {
    key: 'categoryFolder',
    get: function get() {
      return this.idParts.slice(0, 2).join('/');
    }
  }, {
    key: 'metadata',
    get: function get() {
      return (0, _extends3.default)({}, this.fileData, this.data);
    }
  }, {
    key: 'idPair',
    get: function get() {
      return [this.id, this];
    }
  }, {
    key: 'isIndex',
    get: function get() {
      return !!(this.id.match(/index$/) || this.file.basename === 'index.js');
    }
  }, {
    key: 'isPackageManifest',
    get: function get() {
      return this.fileBaseName === 'package.json';
    }
  }, {
    key: 'variationsBase',
    get: function get() {
      return this.isIndex ? this.fileDirnameBasename : this.fileStem;
    }
  }, {
    key: 'fileExtname',
    get: function get() {
      return this.file.extname;
    }
  }, {
    key: 'isMarkdown',
    get: function get() {
      return this.fileExtname && this.fileExtname.match(/.md$/);
    }
  }, {
    key: 'isJavascript',
    get: function get() {
      return this.fileExtname && this.fileExtname.match(/.js$/);
    }
  }, {
    key: 'fileData',
    get: function get() {
      return (0, _isFunction2.default)(this.options.getFileData) ? this.options.getFileData.call(this, this.file) : this.get('file.data', {});
    }
  }, {
    key: 'fileMessages',
    get: function get() {
      return this.file.messages;
    }
  }, {
    key: 'variations',
    get: function get() {
      return (0, _extends3.default)({}, this.createStemVariations(this.variationsBase), {
        singularized: this.createStemVariations(this.variationsBase, {
          singularize: true
        }),
        pluralized: this.createStemVariations(this.variationsBase, {
          pluralize: true
        })
      });
    }
  }, {
    key: 'nameVariations',
    get: function get() {
      var variations = this.variations;

      return (0, _uniq2.default)((0, _values2.default)((0, _omit2.default)(variations, 'pluralized', 'singularized')).concat((0, _values2.default)(variations.pluralized), (0, _values2.default)(variations.singularized)));
    }
  }, {
    key: 'indexVariations',
    get: function get() {
      return this.createStemVariations(this.variationsBase, {
        suffix: '/index' + this.fileExtname
      });
    }
  }, {
    key: 'filenameVariations',
    get: function get() {
      return (0, _extends3.default)({}, this.createStemVariations(this.variationsBase, {
        suffix: this.fileExtname
      }));
    }
  }, {
    key: 'fileStem',
    get: function get() {
      return this.file.stem;
    }
  }, {
    key: 'fileBaseName',
    get: function get() {
      return this.file.basename;
    }
  }, {
    key: 'fileDirname',
    get: function get() {
      return this.file.dirname;
    }
  }, {
    key: 'fileDirnameBasename',
    get: function get() {
      return (0, _path.basename)(this.fileDirname);
    }
  }, {
    key: 'baseRelativePath',
    get: function get() {
      return (0, _path.relative)(this.cwd, this.path);
    }
  }, {
    key: 'stat',
    get: function get() {
      return this.get('file.stat', {});
    }
  }, {
    key: 'cacheKey',
    get: function get() {
      return this.file && this.file.stat ? [Math.floor(this.stat.mtime / 100), this.stat.size].join(':') : this.id;
    }
  }, {
    key: 'isRemote',
    get: function get() {
      return this.uri.protocol.indexOf('http') !== -1;
    }
  }]);
  return Document;
}(), _class.patterns = DefaultPatterns, _temp);
exports.default = Document;
function normalizeUri(input) {
  var cwd = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : process.cwd();

  if (typeof input !== 'string') {
    throw 'Must pass the URI as a string';
  }

  var parsed = _url2.default.parse(input);

  var isFilePath = parsed.protocol === null || parsed.protocol.indexOf('file') !== -1;
  var isRemoteUrl = !isFilePath && parsed.protocol.indexOf('http') !== -1;
  var isAbsoluteFilePath = isFilePath && (0, _pathIsAbsolute2.default)(parsed.path);

  if (isRemoteUrl) {
    return _url2.default.format(parsed);
  }

  if (isFilePath && isAbsoluteFilePath) {
    return _url2.default.format({
      protocol: 'file:',
      slashes: true,
      pathname: parsed.path
    });
  } else {
    return _url2.default.format({
      protocol: 'file:',
      slashes: true,
      pathname: (0, _path.resolve)(cwd, parsed.path)
    });
  }

  return input;
}

/***/ },

/***/ "./src/git/index.js":
/***/ function(module, exports, __webpack_require__) {

"use strict";
'use strict';

var fs = __webpack_require__(48);
var path = __webpack_require__(5);
var zlib = __webpack_require__(49);

var GIT_DIR = '.git';

function findRepo(startingPath) {
  var gitPath = void 0,
      lastPath = void 0;
  var currentPath = startingPath;

  if (!currentPath) {
    currentPath = process.cwd();
  }

  do {
    gitPath = path.join(currentPath, GIT_DIR);

    if (fs.existsSync(gitPath)) {
      return gitPath;
    }

    lastPath = currentPath;
    currentPath = path.resolve(currentPath, '..');
  } while (lastPath !== currentPath);

  return null;
}

function findPackedTag(gitPath, sha) {
  var packedRefsFilePath = path.join(gitPath, 'packed-refs');
  if (fs.existsSync(packedRefsFilePath)) {
    var packedRefsFile = fs.readFileSync(packedRefsFilePath, { encoding: 'utf8' });
    var tagLine = packedRefsFile.split('\n').filter(function (line) {
      return line.indexOf('refs/tags') > -1 && line.indexOf(sha) > -1;
    })[0];

    if (tagLine) {
      return tagLine.split('tags/')[1];
    }
  }
}

function commitForTag(gitPath, tag) {
  var tagPath = path.join(gitPath, 'refs', 'tags', tag);
  var taggedObject = fs.readFileSync(tagPath, { encoding: 'utf8' }).trim();
  var objectPath = path.join(gitPath, 'objects', taggedObject.slice(0, 2), taggedObject.slice(2));

  if (!zlib.inflateSync || !fs.existsSync(objectPath)) {
    // we cannot support annotated tags on node v0.10 because
    // zlib does not allow sync access
    return taggedObject;
  }

  var objectContents = zlib.inflateSync(fs.readFileSync(objectPath)).toString();

  // 'tag 172\u0000object c1ee41c325d54f410b133e0018c7a6b1316f6cda\ntype commit\ntag awesome-tag\ntagger Robert Jackson <robert.w.jackson@me.com> 1429100021 -0400\n\nI am making an annotated tag.\n'
  if (objectContents.slice(0, 3) === 'tag') {
    var sections = objectContents.split(/\0|\n/);
    var sha = sections[1].slice(7);

    return sha;
  } else {
    // this will return the tag for lightweight tags
    return taggedObject;
  }
}

function findTag(gitPath, sha) {
  var tag = findPackedTag(gitPath, sha);
  if (tag) {
    return tag;
  }

  var tagsPath = path.join(gitPath, 'refs', 'tags');
  if (!fs.existsSync(tagsPath)) {
    return false;
  }

  var tags = fs.readdirSync(tagsPath);

  for (var i = 0, l = tags.length; i < l; i++) {
    tag = tags[i];
    var commitAtTag = commitForTag(gitPath, tags[i]);

    if (commitAtTag === sha) {
      return tag;
    }
  }
}

module.exports = function (gitPath) {
  gitPath = findRepo(gitPath);

  var result = {
    sha: null,
    abbreviatedSha: null,
    branch: null,
    tag: null,
    root: path.resolve(gitPath, '..')
  };

  try {
    var headFilePath = path.join(gitPath, 'HEAD');

    if (fs.existsSync(headFilePath)) {
      var headFile = fs.readFileSync(headFilePath, { encoding: 'utf8' });
      var branchName = headFile.split('/').slice(2).join('/').trim();
      if (!branchName) {
        branchName = headFile.split('/').slice(-1)[0].trim();
      }
      var refPath = headFile.split(' ')[1];

      // Find branch and SHA
      if (refPath) {
        var branchPath = path.join(gitPath, refPath.trim());

        result.branch = branchName;
        result.sha = fs.readFileSync(branchPath, { encoding: 'utf8' }).trim();
      } else {
        result.sha = branchName;
      }

      result.abbreviatedSha = result.sha.slice(0, 10);

      // Find tag
      var tag = findTag(gitPath, result.sha);
      if (tag) {
        result.tag = tag;
      }
    }
  } catch (e) {
    if (!module.exports._suppressErrors) {
      throw e; // helps with testing and scenarios where we do not expect errors
    } else {
        // eat the error
      }
  }

  return result;
};

module.exports._suppressErrors = true;
module.exports._findRepo = findRepo;

/***/ },

/***/ "./src/importers/node-vinyl.js":
/***/ function(module, exports, __webpack_require__) {

"use strict";
'use strict';

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.DocumentImporter = exports.toVFile = exports.DefaultOptions = undefined;

var _defineProperty = __webpack_require__(31);

var _defineProperty2 = _interopRequireDefault(_defineProperty);

var _toConsumableArray2 = __webpack_require__(4);

var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);

var _extends2 = __webpack_require__(0);

var _extends3 = _interopRequireDefault(_extends2);

var _classCallCheck2 = __webpack_require__(1);

var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);

var _createClass2 = __webpack_require__(2);

var _createClass3 = _interopRequireDefault(_createClass2);

var _class, _temp;

var _isArray = __webpack_require__(51);

var _isArray2 = _interopRequireDefault(_isArray);

var _uniq = __webpack_require__(18);

var _uniq2 = _interopRequireDefault(_uniq);

var _vinylRead = __webpack_require__(54);

var _vinylRead2 = _interopRequireDefault(_vinylRead);

var _convertVinylToVfile = __webpack_require__(50);

var _convertVinylToVfile2 = _interopRequireDefault(_convertVinylToVfile);

var _skypagerUtil = __webpack_require__(3);

var _document = __webpack_require__("./src/document/index.js");

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

var defineProperty = _defineProperty2.default;
var DefaultOptions = exports.DefaultOptions = {
  patterns: _document.DefaultPatterns
};

var toVFile = exports.toVFile = function toVFile(vinyl) {
  return (0, _convertVinylToVfile2.default)(vinyl);
};

var DocumentImporter = exports.DocumentImporter = (_temp = _class = function () {
  (0, _createClass3.default)(DocumentImporter, null, [{
    key: 'create',
    value: function create(cwd) {
      var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};

      if (typeof options === 'string') {
        options = {
          patterns: [options],
          cwd: cwd
        };
      }

      if ((0, _isArray2.default)(options)) {
        options = {
          cwd: cwd,
          patterns: options
        };
      }

      var importer = new DocumentImporter(cwd, (0, _extends3.default)({
        cwd: cwd
      }, options));

      return importer;
    }
  }]);

  function DocumentImporter() {
    var cwd = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : process.cwd();
    var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
    (0, _classCallCheck3.default)(this, DocumentImporter);

    (0, _skypagerUtil.mixinPropertyUtils)(this);

    if (typeof cwd !== 'string') {
      throw 'Document Importers must be created with a cwd path';
    }

    this.cwd = cwd;

    this.hide('options', (0, _extends3.default)({}, DefaultOptions, options));

    delete this.options.cwd;

    this.patterns = [].concat((0, _toConsumableArray3.default)(this.options.patterns || DefaultOptions.patterns || []), ['!**/*.lock']);

    if (this.options.collection) {
      var _patterns;

      (_patterns = this.patterns).push.apply(_patterns, (0, _toConsumableArray3.default)(this.options.collection.patterns || []));
    }

    this.patterns = (0, _uniq2.default)(this.patterns);

    var status = 'CREATED';

    defineProperty(this, 'status', {
      configurable: false,
      get: function get() {
        return status;
      },
      set: function set(newValue) {
        return status = newValue;
      }
    });
  }

  (0, _createClass3.default)(DocumentImporter, [{
    key: 'readFilesSync',
    value: function readFilesSync(includeContents) {
      return _vinylRead2.default.sync(this.patterns, (0, _extends3.default)({
        base: this.cwd,
        read: includeContents !== false && this.options.includeContents === true
      }, this.options));
    }
  }, {
    key: 'readFiles',
    value: function readFiles() {
      var includeContents = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false;

      return (0, _vinylRead2.default)(this.patterns, (0, _extends3.default)({
        base: this.cwd,
        read: includeContents === true
      }, this.options));
    }
  }, {
    key: 'fileWrappersSync',
    get: function get() {
      return _vinylRead2.default.sync(this.patterns, (0, _extends3.default)({
        base: this.cwd,
        cwd: this.cwd,
        read: this.options.includeContents === true
      }, this.options));
    }
  }, {
    key: 'fileWrappers',
    get: function get() {
      return (0, _vinylRead2.default)(this.patterns, (0, _extends3.default)({
        base: this.cwd,
        read: this.options.includeContents === true
      }, this.options));
    }
  }]);
  return DocumentImporter;
}(), _class.patterns = _document.DefaultPatterns, _temp);
exports.default = DocumentImporter;

/***/ },

/***/ 128:
/***/ function(module, exports, __webpack_require__) {

var map = {
	"./node-vinyl.js": "./src/importers/node-vinyl.js"
};
function webpackContext(req) {
	return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
	var id = map[req];
	if(!(id + 1)) // check for number
		throw new Error("Cannot find module '" + req + "'.");
	return id;
};
webpackContext.keys = function webpackContextKeys() {
	return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 128;


/***/ },

/***/ 38:
/***/ function(module, exports, __webpack_require__) {

var map = {
	"./node-vinyl.js": "./src/importers/node-vinyl.js"
};
function webpackContext(req) {
	return __webpack_require__(webpackContextResolve(req));
};
function webpackContextResolve(req) {
	var id = map[req];
	if(!(id + 1)) // check for number
		throw new Error("Cannot find module '" + req + "'.");
	return id;
};
webpackContext.keys = function webpackContextKeys() {
	return Object.keys(map);
};
webpackContext.resolve = webpackContextResolve;
module.exports = webpackContext;
webpackContext.id = 38;


/***/ }

};;