@nxworker/workspace
Version:
Nx plugin providing generators for managing workspace files, including the move-file generator for safely moving files between projects while updating all imports
28 lines (27 loc) • 1.07 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "pointsToProjectIndex", {
enumerable: true,
get: function() {
return pointsToProjectIndex;
}
});
const _devkit = require("@nx/devkit");
const _isindexfilepath = require("./is-index-file-path");
function pointsToProjectIndex(tree, pathStr, sourceRoot) {
const normalizedPathStr = (0, _devkit.normalizePath)(pathStr);
const normalizedSourceRoot = (0, _devkit.normalizePath)(sourceRoot);
// First, check if path is within the project's source root
if (normalizedPathStr !== normalizedSourceRoot && !normalizedPathStr.startsWith(`${normalizedSourceRoot}/`)) {
return false;
}
// Try dynamic verification: check if the file actually exists
if (tree.exists(normalizedPathStr)) {
return true;
}
// Fallback to hard-coded pattern matching for common index file patterns
return (0, _isindexfilepath.isIndexFilePath)(normalizedPathStr);
}
//# sourceMappingURL=points-to-project-index.js.map