Skip to content

Commit

Permalink
chore(core): remove fast-glob from core nx (#18975)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cammisuli authored Sep 7, 2023
1 parent f71f2ac commit 7e2a19b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 27 deletions.
1 change: 0 additions & 1 deletion packages/nx/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,6 @@
"dotenv": "~16.3.1",
"dotenv-expand": "~10.0.0",
"enquirer": "~2.3.6",
"fast-glob": "3.2.7",
"figures": "3.2.0",
"flat": "^5.0.2",
"fs-extra": "^11.1.0",
Expand Down
30 changes: 5 additions & 25 deletions packages/nx/src/daemon/server/outputs-tracking.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { lstat } from 'fs-extra';
import { dirname, join } from 'path';
import * as fastGlob from 'fast-glob';
import { workspaceRoot } from '../../utils/workspace-root';
import { collapseExpandedOutputs } from '../../utils/collapse-expanded-outputs';
import type { Event } from '@parcel/watcher';
import { getFilesForOutputs } from '../../native';

let disabled = false;

Expand Down Expand Up @@ -59,30 +59,10 @@ export async function outputsHashesMatch(_outputs: string[], hash: string) {
}

async function normalizeOutputs(outputs: string[]) {
return (
await Promise.all(outputs.map((o) => normalizeOutput(o, true)))
).flat();
}

async function normalizeOutput(
output: string,
expand: boolean
): Promise<string[]> {
try {
await lstat(join(workspaceRoot, output));
return [output];
} catch (e) {
if (expand) {
const expanded = collapseExpandedOutputs(
await fastGlob(output, { cwd: workspaceRoot, dot: true })
);
return (
await Promise.all(expanded.map((e) => normalizeOutput(e, false)))
).flat();
} else {
return [];
}
}
let expandedOutputs = collapseExpandedOutputs(
getFilesForOutputs(workspaceRoot, outputs)
);
return expandedOutputs;
}

export function processFileChangesInOutputs(
Expand Down
1 change: 0 additions & 1 deletion packages/nx/src/utils/ignore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ import { workspaceRoot } from './workspace-root';

/**
* An array of glob patterns that should always be ignored.
* Uses path/posix, since fast-glob requires unix paths.
*/
export const ALWAYS_IGNORE = getAlwaysIgnore();

Expand Down

0 comments on commit 7e2a19b

Please sign in to comment.