Skip to content

Conversation

@11bit
Copy link
Collaborator

@11bit 11bit commented Jul 7, 2025

Closes #51

@11bit 11bit requested a review from Copilot July 7, 2025 06:36
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

Adds support for the new max_result_dimension (alias mrd) option to configure the maximum image output dimension.

  • Defines a MaxResultDimensionOptionsPartial type and updates the shared options index.
  • Implements test and build functions with guards and exports the new option.
  • Adds comprehensive unit tests and a changeset for version bump.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
tests/optionsBasic/maxResultDimension.test.ts New tests covering test and build behaviors
src/types/maxResultDimension.ts Introduces type alias and options interface
src/types/index.ts Exports the new options interface in Options type
src/options/maxResultDimension.ts Implements option parsing, validation, and encoding
src/options/index.ts Exports maxResultDimension in the options entrypoint
.changeset/fresh-bushes-lick.md Adds changeset for the new minor version
Comments suppressed due to low confidence (3)

tests/optionsBasic/maxResultDimension.test.ts:43

  • Add a test case where both max_result_dimension and mrd are provided (e.g. { max_result_dimension: X, mrd: Y }) to verify that max_result_dimension takes precedence.
    it("should return mrd:1920 if mrd option is 1920", () => {

src/options/maxResultDimension.ts:17

  • Add an explicit check for negative values before building the output (e.g. if (maxResultDimension! < 0) throw new RangeError("max_result_dimension option value can't be less than 0");) so that inputs below 0 are correctly rejected.
  const maxResultDimension = getOpt(options);

tests/optionsBasic/maxResultDimension.test.ts:51

  • [nitpick] This zero-value test is duplicated; consider removing one of the identical assertions to keep the suite concise.
    it("should work with 0", () => {

@11bit 11bit force-pushed the feat/max-result-dimension branch from 04cf967 to 79ae306 Compare July 7, 2025 06:43
@11bit 11bit merged commit 6fc690b into main Jul 7, 2025
2 checks passed
@11bit 11bit deleted the feat/max-result-dimension branch July 7, 2025 06:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Usage docs of imgproxy have been updated

2 participants