src/utility/find-module.js
function findModuleFromOptions(host, options) {
    if (options.hasOwnProperty('skipImport') && options.skipImport) {
        return undefined;
    }
    if (!options.module) {
        const pathToCheck = (options.sourceDir || '') + '/' + (options.path || '')
            + (options.flat ? '' : '/' + strings_1.dasherize(options.name));
        return core_1.normalize(findModule(host, pathToCheck));
    }
    else {
        const modulePath = core_1.normalize('/' + options.sourceDir + '/' + (options.appRoot || options.path) + '/' + options.module);
        const moduleBaseName = core_1.normalize(modulePath).split('/').pop();
        if (host.exists(modulePath)) {
            return core_1.normalize(modulePath);
        }
        else if (host.exists(modulePath + '.ts')) {
            return core_1.normalize(modulePath + '.ts');
        }
        else if (host.exists(modulePath + '.module.ts')) {
            return core_1.normalize(modulePath + '.module.ts');
        }
        else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {
            return core_1.normalize(modulePath + '/' + moduleBaseName + '.module.ts');
        }
        else {
            throw new Error('Specified module does not exist');
        }
    }
}
function findModuleFromOptions(host, options) {
    if (options.hasOwnProperty('skipImport') && options.skipImport) {
        return undefined;
    }
    if (!options.module) {
        const pathToCheck = (options.sourceDir || '') + '/' + (options.path || '')
            + (options.flat ? '' : '/' + strings_1.dasherize(options.name));
        return core_1.normalize(findModule(host, pathToCheck));
    }
    else {
        const modulePath = core_1.normalize('/' + options.sourceDir + '/' + (options.appRoot || options.path) + '/' + options.module);
        const moduleBaseName = core_1.normalize(modulePath).split('/').pop();
        if (host.exists(modulePath)) {
            return core_1.normalize(modulePath);
        }
        else if (host.exists(modulePath + '.ts')) {
            return core_1.normalize(modulePath + '.ts');
        }
        else if (host.exists(modulePath + '.module.ts')) {
            return core_1.normalize(modulePath + '.module.ts');
        }
        else if (host.exists(modulePath + '/' + moduleBaseName + '.module.ts')) {
            return core_1.normalize(modulePath + '/' + moduleBaseName + '.module.ts');
        }
        else {
            throw new Error('Specified module does not exist');
        }
    }
}
function findModuleFromOptions ( host , options ) { if ( options . hasOwnProperty ( 'skipImport' ) && options . skipImport ) { return undefined ; } if ( ! options . module ) { const pathToCheck = ( options . sourceDir || '' ) + '/' + ( options . path || '' ) + ( options . flat ? '' : '/' + strings_1 . dasherize ( options . name ) ) ; return core_1 . normalize ( findModule ( host , pathToCheck ) ) ; } else { const modulePath = core_1 . normalize ( '/' + options . sourceDir + '/' + ( options . appRoot || options . path ) + '/' + options . module ) ; const moduleBaseName = core_1 . normalize ( modulePath ) . split ( '/' ) . pop ( ) ; if ( host . exists ( modulePath ) ) { return core_1 . normalize ( modulePath ) ; } else if ( host . exists ( modulePath + '.ts' ) ) { return core_1 . normalize ( modulePath + '.ts' ) ; } else if ( host . exists ( modulePath + '.module.ts' ) ) { return core_1 . normalize ( modulePath + '.module.ts' ) ; } else if ( host . exists ( modulePath + '/' + moduleBaseName + '.module.ts' ) ) { return core_1 . normalize ( modulePath + '/' + moduleBaseName + '.module.ts' ) ; } else { throw new Error ( 'Specified module does not exist' ) ; } } }
Find the module referred by a set of options passed to the schematics.
Find the module referred by a set of options passed to the schematics .