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/adapter/angular-json.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.renamePropertyWithStableKeys = exports.toOldFormat = exports.toNewFormat = exports.isAngularPluginInstalled = exports.shouldMergeAngularProjects = exports.NxAngularJsonPlugin = exports.NX_ANGULAR_JSON_PLUGIN_NAME = void 0;
const fs_1 = require("fs");
const path = require("path");
const fileutils_1 = require("../utils/fileutils");
exports.NX_ANGULAR_JSON_PLUGIN_NAME = 'nx-angular-json-plugin';
exports.NxAngularJsonPlugin = {
    name: exports.NX_ANGULAR_JSON_PLUGIN_NAME,
    createNodes: [
        'angular.json',
        (f, _, ctx) => ({
            projects: readAngularJson(ctx.workspaceRoot),
        }),
    ],
};
function shouldMergeAngularProjects(root, includeProjectsFromAngularJson) {
    if ((0, fs_1.existsSync)(path.join(root, 'angular.json')) &&
        // Include projects from angular.json if explicitly required.
        // e.g. when invoked from `packages/devkit/src/utils/convert-nx-executor.ts`
        (includeProjectsFromAngularJson ||
            // Or if a workspace has `@nrwl/angular`/`@nx/angular` installed then projects from `angular.json` to be considered by Nx.
            isAngularPluginInstalled())) {
        return true;
    }
    else {
        return false;
    }
}
exports.shouldMergeAngularProjects = shouldMergeAngularProjects;
function isAngularPluginInstalled() {
    try {
        // nx-ignore-next-line
        require.resolve('@nx/angular');
        return true;
    }
    catch {
        try {
            require.resolve('@nrwl/angular');
            return true;
        }
        catch {
            return false;
        }
    }
}
exports.isAngularPluginInstalled = isAngularPluginInstalled;
function readAngularJson(angularCliWorkspaceRoot) {
    return toNewFormat((0, fileutils_1.readJsonFile)(path.join(angularCliWorkspaceRoot, 'angular.json'))).projects;
}
function toNewFormat(w) {
    if (!w.projects) {
        return w;
    }
    for (const name in w.projects ?? {}) {
        const projectConfig = w.projects[name];
        if (projectConfig.architect) {
            renamePropertyWithStableKeys(projectConfig, 'architect', 'targets');
        }
        if (projectConfig.schematics) {
            renamePropertyWithStableKeys(projectConfig, 'schematics', 'generators');
        }
        if (!projectConfig.name) {
            projectConfig.name = name;
        }
        Object.values(projectConfig.targets || {}).forEach((target) => {
            if (target.builder !== undefined) {
                renamePropertyWithStableKeys(target, 'builder', 'executor');
            }
        });
    }
    if (w.schematics) {
        renamePropertyWithStableKeys(w, 'schematics', 'generators');
    }
    if (w.version !== 2) {
        w.version = 2;
    }
    return w;
}
exports.toNewFormat = toNewFormat;
function toOldFormat(w) {
    if (w.projects) {
        for (const name in w.projects) {
            const projectConfig = w.projects[name];
            if (typeof projectConfig === 'string') {
                throw new Error("'project.json' files are incompatible with version 1 workspace schemas.");
            }
            if (projectConfig.targets) {
                renamePropertyWithStableKeys(projectConfig, 'targets', 'architect');
            }
            if (projectConfig.generators) {
                renamePropertyWithStableKeys(projectConfig, 'generators', 'schematics');
            }
            delete projectConfig.name;
            Object.values(projectConfig.architect || {}).forEach((target) => {
                if (target.executor !== undefined) {
                    renamePropertyWithStableKeys(target, 'executor', 'builder');
                }
            });
        }
    }
    if (w.generators) {
        renamePropertyWithStableKeys(w, 'generators', 'schematics');
    }
    if (w.version !== 1) {
        w.version = 1;
    }
    return w;
}
exports.toOldFormat = toOldFormat;
// we have to do it this way to preserve the order of properties
// not to screw up the formatting
function renamePropertyWithStableKeys(obj, from, to) {
    const copy = { ...obj };
    Object.keys(obj).forEach((k) => {
        delete obj[k];
    });
    Object.keys(copy).forEach((k) => {
        if (k === from) {
            obj[to] = copy[k];
        }
        else {
            obj[k] = copy[k];
        }
    });
}
exports.renamePropertyWithStableKeys = renamePropertyWithStableKeys;