components/node_modules/vue-docgen-api/dist/script-handlers/mixinsHandler.js
/**
 * @returns {object} an object containing the documentations for each mixin
 * key: mixin variable name
 * value: documentation of named mixin
 */
@returns {object} an object containing the documentations for each mixin
key: mixin variable name
value: documentation of named mixin
@returns { object } an object containing the documentations for each mixin key : mixin variable name value : documentation of named mixin
function mixinsHandler(documentation, componentDefinition, astPath, opt) {
    return __awaiter(this, void 0, void 0, function () {
        var originalDirName, pathResolver, mixinVariableNames, mixinVarToFilePath, files, _loop_1, _i, _a, varName;
        var _this = this;
        return __generator(this, function (_b) {
            switch (_b.label) {
                case 0:
                    originalDirName = path.dirname(opt.filePath);
                    pathResolver = makePathResolver_1.default(originalDirName, opt.alias);
                    mixinVariableNames = getMixinsVariableNames(componentDefinition);
                    if (!mixinVariableNames || !mixinVariableNames.length) {
                        return [2 ];
                    }
                    mixinVarToFilePath = resolveRequired_1.default(astPath, mixinVariableNames);
                    return [4 , adaptExportsToIEV_1.default(pathResolver, mixinVarToFilePath, opt.validExtends)
                    ];
                case 1:
                    _b.sent();
                    files = new ts_map_1.default();
                    _loop_1 = function (varName) {
                        var _a = mixinVarToFilePath[varName], filePath = _a.filePath, exportName = _a.exportName;
                        filePath.forEach(function (p) {
                            var fullFilePath = pathResolver(p);
                            if (opt.validExtends(fullFilePath)) {
                                var vars = files.get(fullFilePath) || [];
                                vars.push(exportName);
                                files.set(fullFilePath, vars);
                            }
                        });
                    };
                    for (_i = 0, _a = Object.keys(mixinVarToFilePath); _i < _a.length; _i++) {
                        varName = _a[_i];
                        _loop_1(varName);
                    }
                    return [4 , files.keys().reduce(function (_, fullFilePath) { return __awaiter(_this, void 0, void 0, function () {
                            var vars, mixinVar, e_1;
                            return __generator(this, function (_a) {
                                switch (_a.label) {
                                    case 0: return [4 , _];
                                    case 1:
                                        _a.sent();
                                        vars = files.get(fullFilePath);
                                        if (!(fullFilePath && vars)) return [3 , 5];
                                        _a.label = 2;
                                    case 2:
                                        _a.trys.push([2, 4, , 5]);
                                        mixinVar = {
                                            name: '<mixin/>',
                                            path: fullFilePath
                                        };
                                        return [4 , parse_1.parseFile(__assign(__assign({}, opt), { filePath: fullFilePath, nameFilter: vars, mixin: mixinVar }), documentation)];
                                    case 3:
                                        _a.sent();
                                        mixinVar.name = documentation.get('displayName');
                                        documentation.set('displayName', null);
                                        return [3 , 5];
                                    case 4:
                                        e_1 = _a.sent();
                                        return [3 , 5];
                                    case 5: return [2 ];
                                }
                            });
                        }); }, Promise.resolve())];
                case 2:
                    _b.sent();
                    return [2 ];
            }
        });
    });
}
function mixinsHandler ( documentation , componentDefinition , astPath , opt ) { return __awaiter ( this , void 0 , void 0 , function ( ) { var originalDirName , pathResolver , mixinVariableNames , mixinVarToFilePath , files , _loop_1 , _i , _a , varName ; var _this = this ; return __generator ( this , function ( _b ) { switch ( _b . label ) { case 0 : originalDirName = path . dirname ( opt . filePath ) ; pathResolver = makePathResolver_1 . default ( originalDirName , opt . alias ) ; mixinVariableNames = getMixinsVariableNames ( componentDefinition ) ; if ( ! mixinVariableNames || ! mixinVariableNames . length ) { return [ 2 ] ; } mixinVarToFilePath = resolveRequired_1 . default ( astPath , mixinVariableNames ) ; return [ 4 , adaptExportsToIEV_1 . default ( pathResolver , mixinVarToFilePath , opt . validExtends ) ] ; case 1 : _b . sent ( ) ; files = new ts_map_1 . default ( ) ; _loop_1 = function ( varName ) { var _a = mixinVarToFilePath [ varName ] , filePath = _a . filePath , exportName = _a . exportName ; filePath . forEach ( function ( p ) { var fullFilePath = pathResolver ( p ) ; if ( opt . validExtends ( fullFilePath ) ) { var vars = files . get ( fullFilePath ) || [ ] ; vars . push ( exportName ) ; files . set ( fullFilePath , vars ) ; } } ) ; } ; for ( _i = 0 , _a = Object . keys ( mixinVarToFilePath ) ; _i < _a . length ; _i ++ ) { varName = _a [ _i ] ; _loop_1 ( varName ) ; } return [ 4 , files . keys ( ) . reduce ( function ( _ , fullFilePath ) { return __awaiter ( _this , void 0 , void 0 , function ( ) { var vars , mixinVar , e_1 ; return __generator ( this , function ( _a ) { switch ( _a . label ) { case 0 : return [ 4 , _ ] ; case 1 : _a . sent ( ) ; vars = files . get ( fullFilePath ) ; if ( ! ( fullFilePath && vars ) ) return [ 3 , 5 ] ; _a . label = 2 ; case 2 : _a . trys . push ( [ 2 , 4 , , 5 ] ) ; mixinVar = { name : '<mixin/>' , path : fullFilePath } ; return [ 4 , parse_1 . parseFile ( __assign ( __assign ( { } , opt ) , { filePath : fullFilePath , nameFilter : vars , mixin : mixinVar } ) , documentation ) ] ; case 3 : _a . sent ( ) ; mixinVar . name = documentation . get ( 'displayName' ) ; documentation . set ( 'displayName' , null ) ; return [ 3 , 5 ] ; case 4 : e_1 = _a . sent ( ) ; return [ 3 , 5 ] ; case 5 : return [ 2 ] ; } } ) ; } ) ; } , Promise . resolve ( ) ) ] ; case 2 : _b . sent ( ) ; return [ 2 ] ; } } ) ; } ) ; }
@returns {object} an object containing the documentations for each mixin
 key: mixin variable name
 value: documentation of named mixin
@returns { object } an object containing the documentations for each mixin key : mixin variable name value : documentation of named mixin
/*return*/ /*yield*/ // get each doc for each mixin using parse /*yield*/ /*yield*/ /*break*/ /*yield*/ /*break*/ /*break*/ /*return*/ /*return*/