//#region imports
import { BaseClientCompiler, } from 'incremental-compiler/lib-prod';
import { crossPlatformPath, Helpers__NS__error } from 'tnp-core/lib-prod';
import { ___NS__isArray, ___NS__isUndefined } from 'tnp-core/lib-prod';
import { config } from 'tnp-core/lib-prod';
//#endregion
export class BaseCompilerForProject extends BaseClientCompiler {
    project;
    //#region check folder compiler
    checkFolderCompiler(project, options, dontCheck = false) {
        //#region @backendFunc
        if (___NS__isUndefined(options)) {
            return options;
        }
        if (___NS__isUndefined(options.folderPath)) {
            options.folderPath = [];
        }
        const folders = ___NS__isArray(options.folderPath)
            ? options.folderPath
            : [options.folderPath];
        options.folderPath = folders.map(f => {
            f = crossPlatformPath(f);
            if (!dontCheck) {
                if (f.startsWith(crossPlatformPath([project.location, config.folder.node_modules]))) {
                    Helpers__NS__error(`[checkFolderCompiler] Please don't watch node_module folder for ${project.location}`, false, true);
                }
                if (!f.startsWith(project.location) ||
                    f.startsWith(`${project.location}/..`)) {
                    Helpers__NS__error(`[checkFolderCompiler] Please watch only folder inside project ${project.location}`, false, true);
                }
            }
            return f;
        });
        return options;
        //#endregion
    }
    //#endregion
    //#region constructor
    constructor(project, options, allowFolderOutSideProject = false) {
        super();
        this.project = project;
        //#region @backend
        options = this.checkFolderCompiler(project, options, allowFolderOutSideProject);
        if (options) {
            this.initOptions(options);
        }
        //#endregion
    }
}
//# sourceMappingURL=c:/Users/darek/projects/npm/taon-dev/tnp-helpers/dist-nocutsrc-prod/lib/base/classes/base-compiler-for-project.js.map