node_modules/lit-analyzer/lib/index.cjs.js
/**
 * Visits dependencies recursively.
 * @param node
 * @param context
 */
Visits dependencies recursively.
@param node
@param context
Visits dependencies recursively . @param node @param context
function visitDependencies(node, context) {
    if (node == null)
        return;
    if (context.ts.isSourceFile(node)) {
        var existingResult = context.getImportedDefinitionsInFile(node);
        if (existingResult != null) {
            context.addDefinitionsForFile(node, existingResult, false);
        }
        else {
            var result_1 = __spread((context.getDefinitionsInFile(node) || []));
            var isCircular_1 = false;
            var newContext_1 = __assign(__assign({}, context), { 
                lockedFiles: __spread(context.lockedFiles, [node.fileName]), addDefinitionsForFile: function (file, newResults, isCircular) {
                    context.addDefinitionsForFile(file, newResults, isCircular);
                    result_1.push.apply(result_1, __spread(newResults));
                },
                addCircularReference: function () {
                    isCircular_1 = true;
                } });
            node.forEachChild(function (child) { return visitDependencies(child, newContext_1); });
            var uniqueResults = Array.from(new Set(result_1));
            context.addDefinitionsForFile(node, uniqueResults, isCircular_1);
            return;
        }
    }
    else if (context.ts.isImportDeclaration(node) || context.ts.isExportDeclaration(node)) {
        if (node.moduleSpecifier != null && context.ts.isStringLiteral(node.moduleSpecifier)) {
            visitModuleWithName(node.moduleSpecifier.text, node, context);
        }
    }
    else if (context.ts.isCallExpression(node) && node.expression.kind === context.ts.SyntaxKind.ImportKeyword) {
        var moduleSpecifier = node.arguments[0];
        if (moduleSpecifier != null && context.ts.isStringLiteralLike(moduleSpecifier)) {
            visitModuleWithName(moduleSpecifier.text, node, context);
        }
    }
    else {
        node.forEachChild(function (child) { return visitDependencies(child, context); });
    }
}
function visitDependencies ( node , context ) { if ( node == null ) return ; if ( context . ts . isSourceFile ( node ) ) { var existingResult = context . getImportedDefinitionsInFile ( node ) ; if ( existingResult != null ) { context . addDefinitionsForFile ( node , existingResult , false ) ; } else { var result_1 = __spread ( ( context . getDefinitionsInFile ( node ) || [ ] ) ) ; var isCircular_1 = false ; var newContext_1 = __assign ( __assign ( { } , context ) , { lockedFiles : __spread ( context . lockedFiles , [ node . fileName ] ) , addDefinitionsForFile : function ( file , newResults , isCircular ) { context . addDefinitionsForFile ( file , newResults , isCircular ) ; result_1 . push . apply ( result_1 , __spread ( newResults ) ) ; } , addCircularReference : function ( ) { isCircular_1 = true ; } } ) ; node . forEachChild ( function ( child ) { return visitDependencies ( child , newContext_1 ) ; } ) ; var uniqueResults = Array . from ( new Set ( result_1 ) ) ; context . addDefinitionsForFile ( node , uniqueResults , isCircular_1 ) ; return ; } } else if ( context . ts . isImportDeclaration ( node ) || context . ts . isExportDeclaration ( node ) ) { if ( node . moduleSpecifier != null && context . ts . isStringLiteral ( node . moduleSpecifier ) ) { visitModuleWithName ( node . moduleSpecifier . text , node , context ) ; } } else if ( context . ts . isCallExpression ( node ) && node . expression . kind === context . ts . SyntaxKind . ImportKeyword ) { var moduleSpecifier = node . arguments [ 0 ] ; if ( moduleSpecifier != null && context . ts . isStringLiteralLike ( moduleSpecifier ) ) { visitModuleWithName ( moduleSpecifier . text , node , context ) ; } } else { node . forEachChild ( function ( child ) { return visitDependencies ( child , context ) ; } ) ; } }
Visits dependencies recursively.
Visits dependencies recursively .
// It's already cached // Pick up all new components and add them to the scope of this file. // Expand locked files with this file // Filter out duplicates in the "components" array. Eg two files depend on the same elements.