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/web.enelar.com.co/node_modules/nx/src/daemon/server/watcher.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.convertChangeEventsToLogMessage = exports.watchOutputFiles = exports.watchWorkspace = void 0;
const workspace_root_1 = require("../../utils/workspace-root");
const path_1 = require("path");
const socket_utils_1 = require("../socket-utils");
const shutdown_utils_1 = require("./shutdown-utils");
const path_2 = require("../../utils/path");
const ignore_1 = require("../../utils/ignore");
const cache_1 = require("../cache");
const ALWAYS_IGNORE = [...(0, ignore_1.getAlwaysIgnore)(workspace_root_1.workspaceRoot), socket_utils_1.FULL_OS_SOCKET_PATH];
async function watchWorkspace(server, cb) {
    const { Watcher } = await Promise.resolve().then(() => require('../../native'));
    let relativeServerProcess = (0, path_2.normalizePath)((0, path_1.relative)(workspace_root_1.workspaceRoot, cache_1.serverProcessJsonPath));
    let watcher = new Watcher(workspace_root_1.workspaceRoot, [`!${relativeServerProcess}`]);
    watcher.watch((err, events) => {
        if (err) {
            return cb(err, null);
        }
        for (const event of events) {
            if (event.path == relativeServerProcess &&
                (0, cache_1.getDaemonProcessIdSync)() !== process.pid) {
                (0, shutdown_utils_1.handleServerProcessTermination)({
                    server,
                    reason: 'this process is no longer the current daemon (native)',
                });
            }
            if (event.path.endsWith('.gitignore') || event.path === '.nxignore') {
                // If the ignore files themselves have changed we need to dynamically update our cached ignoreGlobs
                (0, shutdown_utils_1.handleServerProcessTermination)({
                    server,
                    reason: 'Stopping the daemon the set of ignored files changed (native)',
                });
            }
        }
        cb(null, events);
    });
    return watcher;
}
exports.watchWorkspace = watchWorkspace;
async function watchOutputFiles(cb) {
    const { Watcher } = await Promise.resolve().then(() => require('../../native'));
    let watcher = new Watcher(workspace_root_1.workspaceRoot, null, false);
    watcher.watch((err, events) => {
        if (err) {
            return cb(err, null);
        }
        if (events.length !== 0) {
            cb(null, events);
        }
    });
    return watcher;
}
exports.watchOutputFiles = watchOutputFiles;
/**
 * NOTE: An event type of "create" will also apply to the case where the user has restored
 * an original version of a file after modifying/deleting it by using git, so we adjust
 * our log language accordingly.
 */
function convertChangeEventsToLogMessage(changeEvents) {
    // If only a single file was changed, show the information inline
    if (changeEvents.length === 1) {
        const { path, type } = changeEvents[0];
        let typeLog = 'updated';
        switch (type) {
            case 'create':
                typeLog = 'created or restored';
                break;
            case 'update':
                typeLog = 'modified';
                break;
            case 'delete':
                typeLog = 'deleted';
                break;
        }
        return `${path} was ${typeLog}`;
    }
    let numCreatedOrRestoredFiles = 0;
    let numModifiedFiles = 0;
    let numDeletedFiles = 0;
    for (const event of changeEvents) {
        switch (event.type) {
            case 'create':
                numCreatedOrRestoredFiles++;
                break;
            case 'update':
                numModifiedFiles++;
                break;
            case 'delete':
                numDeletedFiles++;
                break;
        }
    }
    return `${numCreatedOrRestoredFiles} file(s) created or restored, ${numModifiedFiles} file(s) modified, ${numDeletedFiles} file(s) deleted`;
}
exports.convertChangeEventsToLogMessage = convertChangeEventsToLogMessage;