Skip to content

Commit

Permalink
BREAKING(semver): remove Comparator functions (denoland#4278)
Browse files Browse the repository at this point in the history
* BREAKING(semver): remove comparator functions

* fix
  • Loading branch information
iuioiua authored Feb 5, 2024
1 parent 961256f commit 980545f
Show file tree
Hide file tree
Showing 21 changed files with 16 additions and 122 deletions.
2 changes: 0 additions & 2 deletions semver/comparator_format.ts → semver/_comparator_format.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@ import { format } from "./format.ts";
* @example >=0.0.0
* @param comparator
* @returns A string representation of the comparator
*
* @deprecated (will be removed in 0.215.0) Use {@linkcode SemVerRange} instead of {@linkcode Comparator} and {@linkcode formatRange} for formatting it.
*/
export function comparatorFormat(comparator: Comparator): string {
const { semver, operator } = comparator;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,13 @@
import type { Comparator } from "./types.ts";
import { greaterOrEqual } from "./greater_or_equal.ts";
import { lessOrEqual } from "./less_or_equal.ts";
import { comparatorMin } from "./comparator_min.ts";
import { comparatorMax } from "./comparator_max.ts";
import { comparatorMin } from "./_comparator_min.ts";
import { comparatorMax } from "./_comparator_max.ts";
/**
* Returns true if the range of possible versions intersects with the other comparators set of possible versions
* @param c0 The left side comparator
* @param c1 The right side comparator
* @returns True if any part of the comparators intersect
*
* @deprecated (will be removed in 0.215.0) Use {@linkcode rangeIntersects} instead.
*/
export function comparatorIntersects(
c0: Comparator,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
// Copyright Isaac Z. Schlueter and Contributors. All rights reserved. ISC license.
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assertEquals } from "../assert/mod.ts";
import { parseComparator } from "./parse_comparator.ts";
import { comparatorIntersects } from "./comparator_intersects.ts";
import { parseComparator } from "./_parse_comparator.ts";
import { comparatorIntersects } from "./_comparator_intersects.ts";
import { rangeIntersects } from "./range_intersects.ts";

Deno.test("comparatorIntersects() handles deprecated SemVerRange.ranges property", async (t) => {
Expand Down
2 changes: 0 additions & 2 deletions semver/comparator_max.ts → semver/_comparator_max.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ import { ANY, INVALID, MAX } from "./constants.ts";
* If an invalid comparator is given such as <0.0.0 then
* an out of range semver will be returned.
* @returns the version, the MAX version or the next smallest patch version
*
* @deprecated (will be removed in 0.215.0) Use {@linkcode rangeMax} instead.
*/
export function comparatorMax(semver: SemVer, operator: Operator): SemVer {
if (semver === ANY) {
Expand Down
2 changes: 0 additions & 2 deletions semver/comparator_min.ts → semver/_comparator_min.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ import { increment } from "./increment.ts";
* @param semver The semantic version of the comparator
* @param operator The operator of the comparator
* @returns The minimum valid semantic version
*
* @deprecated (will be removed in 0.215.0) Use {@linkcode rangeMin} instead.
*/
export function comparatorMin(semver: SemVer, operator: Operator): SemVer {
if (semver === ANY) {
Expand Down
2 changes: 0 additions & 2 deletions semver/is_comparator.ts → semver/_is_comparator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ import { ALL, NONE } from "./constants.ts";
* Adds a type assertion if true.
* @param value The value to check if its a Comparator
* @returns True if the object is a Comparator otherwise false
*
* @deprecated (will be removed in 0.215.0) Use {@linkcode isSemVerRange} instead.
*/
export function isComparator(value: unknown): value is Comparator {
if (
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { assert } from "../assert/mod.ts";
import { INVALID, MIN } from "./constants.ts";
import { isComparator } from "./is_comparator.ts";
import { isComparator } from "./_is_comparator.ts";

Deno.test({
name: "valid_comparator",
Expand Down
2 changes: 0 additions & 2 deletions semver/parse_comparator.ts → semver/_parse_comparator.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ type REGEXP_GROUPS = {
* Parses a comparator string into a valid Comparator.
* @param comparator
* @returns A valid Comparator
*
* @deprecated (will be removed in 0.215.0) Use {@linkcode parseRange} instead.
*/
export function parseComparator(comparator: string): Comparator {
const match = comparator.match(COMPARATOR_REGEXP);
Expand Down
4 changes: 2 additions & 2 deletions semver/comparator_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import { assertEquals } from "../assert/mod.ts";
import { parseRange } from "./parse_range.ts";
import { parse } from "./parse.ts";
import { testRange } from "./test_range.ts";
import { parseComparator } from "./parse_comparator.ts";
import { comparatorFormat } from "./comparator_format.ts";
import { parseComparator } from "./_parse_comparator.ts";
import { comparatorFormat } from "./_comparator_format.ts";
import { Comparator } from "./types.ts";

Deno.test({
Expand Down
2 changes: 1 addition & 1 deletion semver/format_range.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import type { Range, SemVerRange } from "./types.ts";
import { comparatorFormat } from "./comparator_format.ts";
import { comparatorFormat } from "./_comparator_format.ts";

/**
* Formats the range into a string
Expand Down
2 changes: 1 addition & 1 deletion semver/is_range.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import type { Range } from "./types.ts";
import { isComparator } from "./is_comparator.ts";
import { isComparator } from "./_is_comparator.ts";

/**
* Does a deep check on the object to determine if its a valid range.
Expand Down
2 changes: 1 addition & 1 deletion semver/is_semver_range.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import type { SemVerRange } from "./types.ts";
import { isComparator } from "./is_comparator.ts";
import { isComparator } from "./_is_comparator.ts";

/**
* Does a deep check on the object to determine if its a valid range.
Expand Down
10 changes: 0 additions & 10 deletions semver/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -251,7 +251,6 @@
* ```ts
* import {
* parse,
* parseComparator,
* parseRange,
* gt,
* lt,
Expand All @@ -271,10 +270,6 @@
*
* @module
*/
export * from "./comparator_format.ts";
export * from "./comparator_intersects.ts";
export * from "./comparator_max.ts";
export * from "./comparator_min.ts";
export * from "./compare.ts";
export * from "./constants.ts";
export * from "./difference.ts";
Expand All @@ -283,7 +278,6 @@ export * from "./format.ts";
export * from "./gt.ts";
export * from "./gte.ts";
export * from "./gtr.ts";
export * from "./test_comparator.ts";
export * from "./test_range.ts";
export * from "./increment.ts";
export * from "./is_semver_range.ts";
Expand All @@ -295,7 +289,6 @@ export * from "./max_satisfying.ts";
export * from "./min_satisfying.ts";
export * from "./neq.ts";
export * from "./outside.ts";
export * from "./parse_comparator.ts";
export * from "./parse_range.ts";
export * from "./parse.ts";
export * from "./range_intersects.ts";
Expand All @@ -304,13 +297,10 @@ export * from "./range_min.ts";
export * from "./types.ts";
export * from "./try_parse_range.ts";
export * from "./is_range.ts";
export * from "./try_parse_comparator.ts";
export * from "./is_comparator.ts";
export * from "./can_parse.ts";
export * from "./reverse_sort.ts";
export * from "./try_parse.ts";
export * from "./format_range.ts";

export * from "./equals.ts";
export * from "./not_equals.ts";
export * from "./greater_than.ts";
Expand Down
2 changes: 1 addition & 1 deletion semver/parse_range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { ALL } from "./constants.ts";
import type { Comparator, Range, SemVerRange } from "./types.ts";
import { OPERATOR_XRANGE_REGEXP, XRANGE } from "./_shared.ts";
import { parseComparator } from "./parse_comparator.ts";
import { parseComparator } from "./_parse_comparator.ts";
import { parseBuild, parsePrerelease } from "./_shared.ts";

function isWildcard(id: string): boolean {
Expand Down
2 changes: 1 addition & 1 deletion semver/range_intersects.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
import { comparatorIntersects } from "./comparator_intersects.ts";
import { comparatorIntersects } from "./_comparator_intersects.ts";
import type { Comparator, Range, SemVerRange } from "./types.ts";

function rangesSatisfiable(ranges: (SemVerRange | Range)[]): boolean {
Expand Down
2 changes: 1 addition & 1 deletion semver/range_max.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { INVALID } from "./constants.ts";
import type { Range, SemVer, SemVerRange } from "./types.ts";
import { testRange } from "./test_range.ts";
import { comparatorMax } from "./comparator_max.ts";
import { comparatorMax } from "./_comparator_max.ts";
import { greaterThan } from "./greater_than.ts";

/**
Expand Down
2 changes: 1 addition & 1 deletion semver/range_min.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { INVALID } from "./constants.ts";
import type { Range, SemVer, SemVerRange } from "./types.ts";
import { testRange } from "./test_range.ts";
import { comparatorMin } from "./comparator_min.ts";
import { comparatorMin } from "./_comparator_min.ts";
import { lessThan } from "./less_than.ts";

/**
Expand Down
42 changes: 0 additions & 42 deletions semver/test_comparator.ts

This file was deleted.

22 changes: 0 additions & 22 deletions semver/test_comparator_test.ts

This file was deleted.

4 changes: 2 additions & 2 deletions semver/test_range.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@
import type { Range, SemVer, SemVerRange } from "./types.ts";
import { greaterOrEqual } from "./greater_or_equal.ts";
import { lessOrEqual } from "./less_or_equal.ts";
import { comparatorMin } from "./comparator_min.ts";
import { comparatorMax } from "./comparator_max.ts";
import { comparatorMin } from "./_comparator_min.ts";
import { comparatorMax } from "./_comparator_max.ts";

/**
* Test to see if the version satisfies the range.
Expand Down
20 changes: 0 additions & 20 deletions semver/try_parse_comparator.ts

This file was deleted.

0 comments on commit 980545f

Please sign in to comment.