Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
refactor(manifest)!: remove deprecated compatibility check methods
  • Loading branch information
paul-soporan committed Jul 20, 2022
commit e3d1860a33b975d2f6be3b96d585cb252fc52318
34 changes: 34 additions & 0 deletions .yarn/versions/fb37557b.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
releases:
"@yarnpkg/cli": major
"@yarnpkg/core": major

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: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ The following changes only affect people writing Yarn plugins:

- `npmConfigUtils.getAuditRegistry` no longer takes a `Manifest` as its first argument.

- `Manifest.isManifestFieldCompatible` and `Manifest.prototype.isCompatibleWith{OS,CPU}` have been removed. Use `Manifest.prototype.getConditions` and `structUtils.isPackageCompatible` instead.

### Installs

- The `pnpm` linker avoids creating symlinks that lead to loops on the file system, by moving them higher up in the directory structure.
Expand Down
41 changes: 0 additions & 41 deletions packages/yarnpkg-core/sources/Manifest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -131,33 +131,6 @@ export class Manifest {
return manifest;
}

static isManifestFieldCompatible(rules: Array<string> | null, actual: string) {
if (rules === null)
return true;

let isNotOnAllowlist = true;
let isOnDenylist = false;

for (const rule of rules) {
if (rule[0] === `!`) {
isOnDenylist = true;

if (actual === rule.slice(1)) {
return false;
}
} else {
isNotOnAllowlist = false;

if (rule === actual) {
return true;
}
}
}

// Denylists with allowlisted items should be treated as allowlists for `os` and `cpu` in `package.json`
return isOnDenylist && isNotOnAllowlist;
}

loadFromText(text: string) {
let data;
try {
Expand Down Expand Up @@ -714,20 +687,6 @@ export class Manifest {
return fields.length > 0 ? fields.join(` & `) : null;
}

/**
* @deprecated Prefer getConditions() instead
*/
isCompatibleWithOS(os: string): boolean {
return Manifest.isManifestFieldCompatible(this.os, os);
}

/**
* @deprecated Prefer getConditions() instead
*/
isCompatibleWithCPU(cpu: string): boolean {
return Manifest.isManifestFieldCompatible(this.cpu, cpu);
}

ensureDependencyMeta(descriptor: Descriptor) {
if (descriptor.range !== `unknown` && !semver.valid(descriptor.range))
throw new Error(`Invalid meta field range for '${structUtils.stringifyDescriptor(descriptor)}'`);
Expand Down