(function (global, factory) {
    typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports, require('@angular-ru/cdk/utils')) :
    typeof define === 'function' && define.amd ? define('@angular-ru/cdk/node.js', ['exports', '@angular-ru/cdk/utils'], factory) :
    (global = typeof globalThis !== 'undefined' ? globalThis : global || self, factory((global['angular-ru'] = global['angular-ru'] || {}, global['angular-ru'].cdk = global['angular-ru'].cdk || {}, global['angular-ru'].cdk.node = global['angular-ru'].cdk.node || {}, global['angular-ru'].cdk.node.js = {}), global['angular-ru'].cdk.utils));
}(this, (function (exports, utils) { 'use strict';

    function checkIsNodeEnvironment() {
        if (utils.isNil(require)) {
            throw new Error("This code can be running only Node.js environments.");
        }
        return true;
    }

    checkIsNodeEnvironment();
    var path$1 = require('path');
    var fs = require('fs');
    function resolveTsConfigPath(tsConfigPath) {
        var resolvedPath = path$1.isAbsolute(tsConfigPath)
            ? tsConfigPath
            : path$1.resolve('.', tsConfigPath);
        resolvedPath = resolvedPath.endsWith('.json') ? resolvedPath : resolvedPath + ".json";
        if (utils.isFalse(fs.existsSync(resolvedPath))) {
            throw new Error("Not found tsconfig file by path: " + resolvedPath);
        }
        return resolvedPath;
    }

    checkIsNodeEnvironment();
    var path = require('path');
    function exposeTsCompilerOptionsByTsConfig(tsConfigPath) {
        var resolvedPath = resolveTsConfigPath(tsConfigPath);
        var tsconfig = require(resolvedPath);
        var compilerOptions = tsconfig.compilerOptions;
        var shouldBeDiscoverPathsInParentTsConfig = utils.isNil(compilerOptions === null || compilerOptions === void 0 ? void 0 : compilerOptions.paths) && utils.isNotNil(tsconfig.extends);
        if (shouldBeDiscoverPathsInParentTsConfig) {
            var parentTsConfigPath = path.resolve(path.dirname(resolvedPath), tsconfig.extends);
            return exposeTsCompilerOptionsByTsConfig(parentTsConfigPath);
        }
        return compilerOptions !== null && compilerOptions !== void 0 ? compilerOptions : {};
    }

    /**
     * Generated bundle index. Do not edit.
     */

    exports.checkIsNodeEnvironment = checkIsNodeEnvironment;
    exports.exposeTsCompilerOptionsByTsConfig = exposeTsCompilerOptionsByTsConfig;
    exports.resolveTsConfigPath = resolveTsConfigPath;

    Object.defineProperty(exports, '__esModule', { value: true });

})));
//# sourceMappingURL=angular-ru-cdk-nodejs.umd.js.map
