Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .pnp.cjs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

34 changes: 34 additions & 0 deletions .yarn/versions/aad3d359.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
releases:
"@yarnpkg/cli": patch
"@yarnpkg/core": patch

declined:
- "@yarnpkg/plugin-compat"
- "@yarnpkg/plugin-constraints"
- "@yarnpkg/plugin-dlx"
- "@yarnpkg/plugin-essentials"
- "@yarnpkg/plugin-exec"
- "@yarnpkg/plugin-file"
- "@yarnpkg/plugin-git"
- "@yarnpkg/plugin-github"
- "@yarnpkg/plugin-http"
- "@yarnpkg/plugin-init"
- "@yarnpkg/plugin-interactive-tools"
- "@yarnpkg/plugin-link"
- "@yarnpkg/plugin-nm"
- "@yarnpkg/plugin-npm"
- "@yarnpkg/plugin-npm-cli"
- "@yarnpkg/plugin-pack"
- "@yarnpkg/plugin-patch"
- "@yarnpkg/plugin-pnp"
- "@yarnpkg/plugin-pnpm"
- "@yarnpkg/plugin-stage"
- "@yarnpkg/plugin-typescript"
- "@yarnpkg/plugin-version"
- "@yarnpkg/plugin-workspace-tools"
- "@yarnpkg/builder"
- "@yarnpkg/doctor"
- "@yarnpkg/extensions"
- "@yarnpkg/nm"
- "@yarnpkg/pnpify"
- "@yarnpkg/sdks"
2 changes: 1 addition & 1 deletion packages/yarnpkg-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
"cross-spawn": "7.0.3",
"diff": "^5.1.0",
"dotenv": "^16.3.1",
"globby": "^11.0.1",
"fast-glob": "^3.2.2",
"got": "^11.7.0",
"lodash": "^4.17.15",
"micromatch": "^4.0.2",
Expand Down
8 changes: 3 additions & 5 deletions packages/yarnpkg-core/sources/Workspace.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import {PortablePath, npath, ppath, xfs, Filename} from '@yarnpkg/fslib';
import globby from 'globby';
import fastGlob from 'fast-glob';

import {HardDependencies, Manifest} from './Manifest';
import {Project} from './Project';
Expand Down Expand Up @@ -60,15 +60,13 @@ export class Workspace {
if (patterns.length === 0)
return;

const relativeCwds = await globby(patterns, {
const relativeCwds = await fastGlob(patterns, {
cwd: npath.fromPortablePath(this.cwd),
expandDirectories: false,
onlyDirectories: true,
onlyFiles: false,
ignore: [`**/node_modules`, `**/.git`, `**/.yarn`],
});

// It seems that the return value of globby isn't in any guaranteed order - not even the directory listing order
// fast-glob returns results in arbitrary order
relativeCwds.sort();

await relativeCwds.reduce(async (previousTask, relativeCwd) => {
Expand Down
15 changes: 6 additions & 9 deletions packages/yarnpkg-core/sources/hashUtils.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import {PortablePath, xfs, npath, FakeFS} from '@yarnpkg/fslib';
import {createHash, BinaryLike} from 'crypto';
import globby from 'globby';
import fastGlob from 'fast-glob';

export function makeHash<T extends string = string>(...args: Array<BinaryLike | null>): T {
const hash = createHash(`sha512`);
Expand Down Expand Up @@ -45,29 +45,26 @@ export async function checksumFile(path: PortablePath, {baseFs, algorithm}: {bas
}

export async function checksumPattern(pattern: string, {cwd}: {cwd: PortablePath}) {
// Note: We use a two-pass glob instead of using the expandDirectories option
// from globby, because the native implementation is broken.
// Note: We use a two-pass glob instead of using globby with the expandDirectories
// option, because the native implementation is broken.
//
// Ref: https://github.com/sindresorhus/globby/issues/147

const dirListing = await globby(pattern, {
const dirListing = await fastGlob(pattern, {
cwd: npath.fromPortablePath(cwd),
expandDirectories: false,
onlyDirectories: true,
unique: true,
});

const dirPatterns = dirListing.map(entry => {
return `${entry}/**/*`;
});

const listing = await globby([pattern, ...dirPatterns], {
const listing = await fastGlob([pattern, ...dirPatterns], {
cwd: npath.fromPortablePath(cwd),
expandDirectories: false,
onlyFiles: false,
unique: true,
});

// fast-glob returns results in arbitrary order
listing.sort();

const hashes = await Promise.all(listing.map(async entry => {
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -7083,7 +7083,7 @@ __metadata:
diff: "npm:^5.1.0"
dotenv: "npm:^16.3.1"
esbuild: "npm:esbuild-wasm@^0.15.15"
globby: "npm:^11.0.1"
fast-glob: "npm:^3.2.2"
got: "npm:^11.7.0"
lodash: "npm:^4.17.15"
micromatch: "npm:^4.0.2"
Expand Down