UNPKG

vue-styleguidist

Version:
27 lines (26 loc) 1.08 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports["default"] = findOrigins; var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray")); /** * Extract in an array all the path to the files * the documented component depends on * @param docs * @return array of relative file paths */ function findOrigins(docs) { var allDescriptors = [].concat((0, _toConsumableArray2["default"])(docs.props || []), (0, _toConsumableArray2["default"])(docs.methods || []), (0, _toConsumableArray2["default"])(docs.slots || []), (0, _toConsumableArray2["default"])(docs.events || [])); var originFilePaths = []; allDescriptors.forEach(function (p) { if (p["extends"] && originFilePaths.indexOf(p["extends"].path) < 0) { originFilePaths.push(p["extends"].path); } if (p.mixin && originFilePaths.indexOf(p.mixin.path) < 0) { originFilePaths.push(p.mixin.path); } }); return originFilePaths; }