mirror of
https://github.com/oven-sh/bun
synced 2026-02-16 13:51:47 +00:00
bun run prettier
This commit is contained in:
committed by
github-actions[bot]
parent
753eeef322
commit
30441585d6
36
packages/bun-types/bun.d.ts
vendored
36
packages/bun-types/bun.d.ts
vendored
@@ -4845,28 +4845,28 @@ declare module "bun" {
|
||||
* Throws an error if either version is invalid.
|
||||
*/
|
||||
function order(v1: StringLike, v2: StringLike): -1 | 0 | 1;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the major version number, or null if the version is invalid.
|
||||
*/
|
||||
function major(version: StringLike): number | null;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the minor version number, or null if the version is invalid.
|
||||
*/
|
||||
function minor(version: StringLike): number | null;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the patch version number, or null if the version is invalid.
|
||||
*/
|
||||
function patch(version: StringLike): number | null;
|
||||
|
||||
|
||||
/**
|
||||
* Returns an array of prerelease components, or null if the version doesn't have a prerelease or is invalid.
|
||||
* Numeric components are parsed as numbers.
|
||||
*/
|
||||
function prerelease(version: StringLike): (string | number)[] | null;
|
||||
|
||||
|
||||
/**
|
||||
* Parses a version string into an object with its components.
|
||||
* Returns null if the version is invalid.
|
||||
@@ -4880,43 +4880,43 @@ declare module "bun" {
|
||||
version: string;
|
||||
raw: string;
|
||||
} | null;
|
||||
|
||||
|
||||
/**
|
||||
* Increments the version by the release type.
|
||||
* Returns the new version string, or null if the version is invalid.
|
||||
*
|
||||
*
|
||||
* @param version The version to increment
|
||||
* @param releaseType The type of release: "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease" | "release"
|
||||
* @param identifier Optional identifier for pre-releases (e.g., "alpha", "beta")
|
||||
*/
|
||||
function bump(version: StringLike, releaseType: "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease" | "release", identifier?: string): string | null;
|
||||
|
||||
function bump(
|
||||
version: StringLike,
|
||||
releaseType: "major" | "premajor" | "minor" | "preminor" | "patch" | "prepatch" | "prerelease" | "release",
|
||||
identifier?: string,
|
||||
): string | null;
|
||||
|
||||
/**
|
||||
* Returns true if the two version ranges intersect (have any versions in common).
|
||||
*/
|
||||
function intersects(range1: StringLike, range2: StringLike): boolean;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns the highest version in the list that satisfies the range, or null if none of them do.
|
||||
*/
|
||||
function maxSatisfying(versions: StringLike[], range: StringLike): string | null;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the lowest version in the list that satisfies the range, or null if none of them do.
|
||||
*/
|
||||
function minSatisfying(versions: StringLike[], range: StringLike): string | null;
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Returns a simplified range expression that matches the same items in the versions list as the input range.
|
||||
*
|
||||
*
|
||||
* @param versions Array of versions to match
|
||||
* @param range The range to simplify
|
||||
* @returns The simplified range, or the original if it can't be simplified
|
||||
*
|
||||
*
|
||||
* @example
|
||||
* ```ts
|
||||
* Bun.semver.simplifyRange(["1.0.0", "1.0.1", "1.0.2"], "1.0.0 || 1.0.1 || 1.0.2"); // "~1.0.0"
|
||||
@@ -4924,7 +4924,7 @@ declare module "bun" {
|
||||
* ```
|
||||
*/
|
||||
function simplifyRange(versions: StringLike[], range: StringLike): string | null;
|
||||
|
||||
|
||||
/**
|
||||
* Returns the valid range string, or null if it's not valid.
|
||||
*/
|
||||
@@ -8104,4 +8104,4 @@ declare module "bun" {
|
||||
*/
|
||||
[Symbol.iterator](): IterableIterator<[string, string]>;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -745,7 +745,7 @@ describe("Bun.semver.major()", () => {
|
||||
expect(Bun.semver.major("0.0.1")).toBe(0);
|
||||
expect(Bun.semver.major("999.888.777")).toBe(999);
|
||||
});
|
||||
|
||||
|
||||
test("should return null for invalid versions", () => {
|
||||
expect(Bun.semver.major("not-a-version")).toBe(null);
|
||||
expect(Bun.semver.major("")).toBe(null);
|
||||
@@ -759,7 +759,7 @@ describe("Bun.semver.minor()", () => {
|
||||
expect(Bun.semver.minor("v2.0.0-alpha.1")).toBe(0);
|
||||
expect(Bun.semver.minor("0.999.1")).toBe(999);
|
||||
});
|
||||
|
||||
|
||||
test("should return null for invalid versions", () => {
|
||||
expect(Bun.semver.minor("not-a-version")).toBe(null);
|
||||
expect(Bun.semver.minor("")).toBe(null);
|
||||
@@ -772,7 +772,7 @@ describe("Bun.semver.patch()", () => {
|
||||
expect(Bun.semver.patch("v2.0.0-alpha.1")).toBe(0);
|
||||
expect(Bun.semver.patch("0.1.999")).toBe(999);
|
||||
});
|
||||
|
||||
|
||||
test("should return null for invalid versions", () => {
|
||||
expect(Bun.semver.patch("not-a-version")).toBe(null);
|
||||
expect(Bun.semver.patch("")).toBe(null);
|
||||
@@ -786,7 +786,7 @@ describe("Bun.semver.prerelease()", () => {
|
||||
expect(Bun.semver.prerelease("1.0.0-0")).toEqual([0]);
|
||||
expect(Bun.semver.prerelease("1.0.0-x.7.z.92")).toEqual(["x", 7, "z", 92]);
|
||||
});
|
||||
|
||||
|
||||
test("should return null for non-prerelease versions", () => {
|
||||
expect(Bun.semver.prerelease("1.2.3")).toBe(null);
|
||||
expect(Bun.semver.prerelease("1.2.3+build")).toBe(null);
|
||||
@@ -807,7 +807,7 @@ describe("Bun.semver.parse()", () => {
|
||||
expect(parsed.version).toBe("1.2.3-alpha.1+build.123");
|
||||
expect(parsed.raw).toBe(v);
|
||||
});
|
||||
|
||||
|
||||
test("should parse simple versions", () => {
|
||||
const parsed = Bun.semver.parse("1.2.3");
|
||||
expect(parsed).not.toBe(null);
|
||||
@@ -818,7 +818,7 @@ describe("Bun.semver.parse()", () => {
|
||||
expect(parsed.build).toBe(null);
|
||||
expect(parsed.version).toBe("1.2.3");
|
||||
});
|
||||
|
||||
|
||||
test("should return null for invalid versions", () => {
|
||||
expect(Bun.semver.parse("not-a-version")).toBe(null);
|
||||
expect(Bun.semver.parse("")).toBe(null);
|
||||
@@ -976,8 +976,6 @@ describe("Bun.semver.intersects()", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
describe("Bun.semver.maxSatisfying()", () => {
|
||||
test("finds the highest satisfying version", () => {
|
||||
const versions = ["1.0.0", "1.2.0", "1.3.0", "2.0.0"];
|
||||
@@ -1014,8 +1012,6 @@ describe("Bun.semver.minSatisfying()", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
describe("Bun.semver.simplifyRange()", () => {
|
||||
test("simplifies OR'd exact versions to tilde range", () => {
|
||||
expect(Bun.semver.simplifyRange(["1.0.0", "1.0.1", "1.0.2"], "1.0.0 || 1.0.1 || 1.0.2")).toBe("~1.0.0");
|
||||
@@ -1026,7 +1022,9 @@ describe("Bun.semver.simplifyRange()", () => {
|
||||
});
|
||||
|
||||
test("returns original range if can't simplify", () => {
|
||||
expect(Bun.semver.simplifyRange(["1.0.0", "2.0.0", "3.0.0"], "1.0.0 || 2.0.0 || 3.0.0")).toBe("1.0.0 || 2.0.0 || 3.0.0");
|
||||
expect(Bun.semver.simplifyRange(["1.0.0", "2.0.0", "3.0.0"], "1.0.0 || 2.0.0 || 3.0.0")).toBe(
|
||||
"1.0.0 || 2.0.0 || 3.0.0",
|
||||
);
|
||||
});
|
||||
|
||||
test("returns original range if already simple", () => {
|
||||
@@ -1205,8 +1203,6 @@ describe("Bun.semver negative tests", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
describe("maxSatisfying() negative tests", () => {
|
||||
test("throws for non-array first argument", () => {
|
||||
expect(() => Bun.semver.maxSatisfying("not-an-array" as any, "^1.0.0")).toThrow();
|
||||
@@ -1224,9 +1220,9 @@ describe("Bun.semver negative tests", () => {
|
||||
expect(Bun.semver.maxSatisfying(["1.0.0"], [] as any)).toBe(null);
|
||||
});
|
||||
|
||||
test("skips non-string versions in array", () => {
|
||||
expect(Bun.semver.maxSatisfying([123, "1.0.0", null, "2.0.0", undefined, {}] as any, "^1.0.0")).toBe("1.0.0");
|
||||
});
|
||||
test("skips non-string versions in array", () => {
|
||||
expect(Bun.semver.maxSatisfying([123, "1.0.0", null, "2.0.0", undefined, {}] as any, "^1.0.0")).toBe("1.0.0");
|
||||
});
|
||||
|
||||
test("returns null for invalid range strings", () => {
|
||||
expect(Bun.semver.maxSatisfying(["1.0.0", "2.0.0"], "")).toBe(null);
|
||||
@@ -1254,8 +1250,6 @@ describe("Bun.semver negative tests", () => {
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
|
||||
describe("simplifyRange() negative tests", () => {
|
||||
test("throws for non-array first argument", () => {
|
||||
expect(() => Bun.semver.simplifyRange("not-an-array" as any, "^1.0.0")).toThrow();
|
||||
|
||||
Reference in New Issue
Block a user