HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux ip-172-31-4-197 6.8.0-1036-aws #38~22.04.1-Ubuntu SMP Fri Aug 22 15:44:33 UTC 2025 x86_64
User: ubuntu (1000)
PHP: 7.4.33
Disabled: pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
Upload Files
File: /var/www/api-management/node_modules/@nestjs/cli/lib/compiler/compiler.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.Compiler = void 0;
const ts = require("typescript");
const base_compiler_1 = require("./base-compiler");
const tsconfig_paths_hook_1 = require("./hooks/tsconfig-paths.hook");
class Compiler extends base_compiler_1.BaseCompiler {
    constructor(pluginsLoader, tsConfigProvider, typescriptLoader) {
        super(pluginsLoader);
        this.tsConfigProvider = tsConfigProvider;
        this.typescriptLoader = typescriptLoader;
    }
    run(configuration, tsConfigPath, appName, _extras, onSuccess) {
        const tsBinary = this.typescriptLoader.load();
        const formatHost = {
            getCanonicalFileName: (path) => path,
            getCurrentDirectory: tsBinary.sys.getCurrentDirectory,
            getNewLine: () => tsBinary.sys.newLine,
        };
        const { options, fileNames, projectReferences } = this.tsConfigProvider.getByConfigFilename(tsConfigPath);
        const createProgram = tsBinary.createIncrementalProgram || tsBinary.createProgram;
        const program = createProgram.call(ts, {
            rootNames: fileNames,
            projectReferences,
            options,
        });
        const plugins = this.loadPlugins(configuration, tsConfigPath, appName);
        const tsconfigPathsPlugin = (0, tsconfig_paths_hook_1.tsconfigPathsBeforeHookFactory)(options);
        const programRef = program.getProgram
            ? program.getProgram()
            : program;
        const before = plugins.beforeHooks.map((hook) => hook(programRef));
        const after = plugins.afterHooks.map((hook) => hook(programRef));
        const afterDeclarations = plugins.afterDeclarationsHooks.map((hook) => hook(programRef));
        const emitResult = program.emit(undefined, undefined, undefined, undefined, {
            before: tsconfigPathsPlugin
                ? before.concat(tsconfigPathsPlugin)
                : before,
            after,
            afterDeclarations,
        });
        const errorsCount = this.reportAfterCompilationDiagnostic(program, emitResult, tsBinary, formatHost);
        if (errorsCount) {
            process.exit(1);
        }
        else if (!errorsCount && onSuccess) {
            onSuccess();
        }
    }
    reportAfterCompilationDiagnostic(program, emitResult, tsBinary, formatHost) {
        const diagnostics = tsBinary
            .getPreEmitDiagnostics(program)
            .concat(emitResult.diagnostics);
        if (diagnostics.length > 0) {
            console.error(tsBinary.formatDiagnosticsWithColorAndContext(diagnostics, formatHost));
            console.info(`Found ${diagnostics.length} error(s).` + tsBinary.sys.newLine);
        }
        return diagnostics.length;
    }
}
exports.Compiler = Compiler;