@nx/rsbuild
Version:
33 lines (32 loc) • 1.11 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.hasRsbuildPlugin = hasRsbuildPlugin;
const devkit_1 = require("@nx/devkit");
const minimatch_1 = require("minimatch");
function hasRsbuildPlugin(tree, projectPath) {
const nxJson = (0, devkit_1.readNxJson)(tree);
if (!projectPath) {
return !!nxJson.plugins?.some((p) => typeof p === 'string' ? p === '@nx/rsbuild' : p.plugin === '@nx/rsbuild');
}
return !!nxJson.plugins?.some((p) => {
if (typeof p === 'string') {
return p === '@nx/rsbuild';
}
if (p.exclude) {
for (const exclude of p.exclude) {
if ((0, minimatch_1.minimatch)(projectPath, exclude)) {
return false;
}
}
}
if (p.include) {
for (const include of p.include) {
if ((0, minimatch_1.minimatch)(projectPath, include)) {
return true;
}
}
}
// if no include or exclude, then it's a match
return true;
});
}