Skip to content
Open
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
18 changes: 18 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,23 @@
# Changelog

## Version 5.2.0

1. **New transformation parameters added:**
- `layerMode` (`lm`): Control layer blending modes in overlay transformations
- `aiEdit` (`e-edit`): AI-powered image editing transformation
- `colorReplace` (`cr`): Replace specific colors in images
- `distort` (`e-distort`): Apply distortion effects to images

2. **Type definitions updated:**
- Improved TypeScript types by synchronizing with the official Node.js SDK
- Enhanced type safety for transformation options, upload options, and responses

3. **Documentation improvements:**
- Added TypeScript versioning policy section to README
- Clarified how type definition improvements may be released in minor/patch versions

_No runtime breaking changes from 5.1.x._

## Version 5.1.0

1. **New helper** `getResponsiveImageAttributes()`
Expand Down
17 changes: 14 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,27 @@ You can install the SDK in your project using npm or yarn.
npm install @imagekit/javascript
```

## Documentation

Refer to the ImageKit [official documentation](https://imagekit.io/docs/integration/javascript) for more details on how to use the SDK.

## TypeScript support

The SDK is written in TypeScript, offering first-class TypeScript support. Enjoy excellent type safety and IntelliSense in your IDE. You can use it in your TypeScript projects without any additional configuration.


To enable type checking in JavaScript projects, add `//@ts-check` at the top of your JavaScript files. This will activate type checking in your IDE.

## Documentation
### TypeScript and the SDK versioning policy

Refer to the ImageKit [official documentation](https://imagekit.io/docs/integration/javascript) for more details on how to use the SDK.
The TypeScript types in this SDK always reflect the latest shape of the ImageKit API. When we make improvements to the type definitions to better reflect the actual runtime behavior, we may release these changes in minor or patch versions. While these changes align types more closely with reality and are not breaking changes at runtime, they might cause new type errors when you upgrade.

We judge this approach to be better than the alternatives: outdated, inaccurate types, or vastly more frequent major releases that would distract from any truly breaking runtime changes. If you encounter type errors after upgrading, you can resolve them by:

- Adding appropriate type guards or assertions
- Updating your code to match the corrected types
- Using `// @ts-ignore` temporarily if you need more time to adjust

Please feel welcome to share your thoughts about the versioning policy in a GitHub issue.

## Changelog

Expand Down
4 changes: 2 additions & 2 deletions package-lock.json

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

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@imagekit/javascript",
"version": "5.1.0",
"version": "5.2.0",
"description": "ImageKit Javascript SDK",
"main": "dist/imagekit.cjs.js",
"module": "dist/imagekit.esm.js",
Expand Down
4 changes: 4 additions & 0 deletions src/constants/supportedTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,16 @@ export const supportedTransforms: { [key: string]: string } = {
aiVariation: "e-genvar",
aiDropShadow: "e-dropshadow",
aiChangeBackground: "e-changebg",
aiEdit: "e-edit",
aiRemoveBackground: "e-bgremove",
aiRemoveBackgroundExternal: "e-removedotbg",
contrastStretch: "e-contrast",
shadow: "e-shadow",
sharpen: "e-sharpen",
unsharpMask: "e-usm",
gradient: "e-gradient",
colorReplace: "cr",
distort: "e-distort",

// Other flags & finishing
progressive: "pr",
Expand All @@ -56,6 +59,7 @@ export const supportedTransforms: { [key: string]: string } = {
trim: "t",
zoom: "z",
page: "pg",
layerMode: "lm",

// Text overlay transformations which are not defined yet
fontSize: "fs",
Expand Down
15 changes: 6 additions & 9 deletions src/index.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,11 @@
import type { SrcOptions, Transformation, UploadOptions, UploadResponse } from "./interfaces";
import type { GetImageAttributesOptions, ResponsiveImageAttributes, SrcOptions, Transformation, UploadOptions, UploadResponse } from "./interfaces";
import { getResponsiveImageAttributes } from "./responsive";
import { ImageKitAbortError, ImageKitInvalidRequestError, ImageKitServerError, ImageKitUploadNetworkError, upload } from "./upload";
import { buildSrc, buildTransformationString } from "./url";
import { getResponsiveImageAttributes } from "./responsive";
import type { GetImageAttributesOptions, ResponsiveImageAttributes } from "./responsive";

export { buildSrc, buildTransformationString, upload, getResponsiveImageAttributes, ImageKitInvalidRequestError, ImageKitAbortError, ImageKitServerError, ImageKitUploadNetworkError };
export { buildSrc, buildTransformationString, getResponsiveImageAttributes, ImageKitAbortError, ImageKitInvalidRequestError, ImageKitServerError, ImageKitUploadNetworkError, upload };
export type {
Transformation,
SrcOptions,
UploadOptions,
UploadResponse,
GetImageAttributesOptions, ResponsiveImageAttributes
GetImageAttributesOptions, ResponsiveImageAttributes, SrcOptions, Transformation, UploadOptions,
UploadResponse
};

35 changes: 0 additions & 35 deletions src/interfaces/SrcOptions.ts

This file was deleted.

Loading