Skip to content

chore: remove p-every #6586

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 30, 2025
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
22 changes: 0 additions & 22 deletions package-lock.json

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

1 change: 0 additions & 1 deletion packages/build/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,6 @@
"minimatch": "^9.0.4",
"os-name": "^6.0.0",
"p-event": "^6.0.0",
"p-every": "^2.0.0",
"p-filter": "^4.0.0",
"p-locate": "^6.0.0",
"p-map": "^7.0.0",
Expand Down
24 changes: 14 additions & 10 deletions packages/build/src/plugins/compatibility.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import _pEvery from 'p-every'
import pLocate from 'p-locate'
import { type PackageJson } from 'read-package-up'
import semver from 'semver'
Expand All @@ -9,9 +8,6 @@ import { SystemLogger } from '../plugins_core/types.js'
import { PluginVersion } from './list.js'
import { CONDITIONS } from './plugin_conditions.js'

// the types of that package seem to be not correct and demand a `pEvery.default()` usage which is wrong
const pEvery = _pEvery as unknown as typeof import('p-every').default

/**
* Retrieve the `expectedVersion` of a plugin:
* - This is the version which should be run
Expand Down Expand Up @@ -128,9 +124,13 @@ const getCompatibleEntry = async function ({
return false
}

return await pEvery(conditions, async ({ type, condition }) =>
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
)
return (
await Promise.all(
conditions.map(async ({ type, condition }) =>
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
),
)
).every(Boolean)
})

if (compatibleEntry) {
Expand Down Expand Up @@ -192,9 +192,13 @@ const getFirstCompatibleEntry = async function ({
return true
}

return await pEvery(conditions, async ({ type, condition }) =>
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
)
return (
await Promise.all(
conditions.map(async ({ type, condition }) =>
CONDITIONS[type].test(condition as any, { nodeVersion, packageJson, packagePath, buildDir }),
),
)
).every(Boolean)
})

if (compatibleEntry) {
Expand Down
14 changes: 7 additions & 7 deletions packages/build/src/plugins/plugin_conditions.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import { join } from 'path'

import _pEvery from 'p-every'
import { type PackageJson } from 'read-package-up'
import semver from 'semver'

Expand All @@ -9,9 +8,6 @@ import { resolvePath } from '../utils/resolve.js'

import { type PluginVersion } from './list.js'

// the types of that package seem to be not correct and demand a `pEvery.default()` usage which is wrong
const pEvery = _pEvery as unknown as typeof import('p-every').default

type ConditionContext = {
nodeVersion: string
packageJson: PackageJson
Expand Down Expand Up @@ -53,9 +49,13 @@ const siteDependenciesTest = async function (
}
}

return await pEvery(Object.entries(allowedSiteDependencies), ([dependencyName, allowedVersion]) =>
siteDependencyTest({ dependencyName, allowedVersion, siteDependencies, buildDir }),
)
return (
await Promise.all(
Object.entries(allowedSiteDependencies).map(async ([dependencyName, allowedVersion]) =>
siteDependencyTest({ dependencyName, allowedVersion, siteDependencies, buildDir }),
),
)
).every(Boolean)
}

const siteDependencyTest = async function ({
Expand Down
Loading