Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(image)!: remove v8 deprecated providers #2634

Merged
merged 8 commits into from
Feb 14, 2024
Merged
21 changes: 21 additions & 0 deletions docs/guide/upgrading_v9/2634.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
### Remove deprecated image providers

Removed deprecated image providers from `faker.image`. They already returned broken image URLs anyways.

| old | replacement |
| ----------------------------------------- | ------------------------------------------------------ |
| faker.image.lorempicsum.image | faker.image.urlPicsumPhotos |
| faker.image.lorempicsum.imageGrayscale | faker.image.urlPicsumPhotos({ grayscale: true }) |
| faker.image.lorempicsum.imageBlurred | faker.image.urlPicsumPhotos({ blur: 4 }) |
| faker.image.lorempicsum.imageRandomSeeded | faker.image.urlPicsumPhotos |
| faker.image.lorempicsum.imageUrl | faker.image.urlPicsumPhotos |
| faker.image.placeholder.imageUrl | faker.image.urlPlaceholder |
| faker.image.placeholder.randomUrl | faker.image.urlPlaceholder |
| faker.image.unsplash.image | faker.image.url |
| faker.image.unsplash.imageUrl | faker.image.url |
| faker.image.unsplash.food | faker.image.urlLoremFlickr({ category: 'food' }) |
| faker.image.unsplash.people | faker.image.urlLoremFlickr({ category: 'people' }) |
| faker.image.unsplash.nature | faker.image.urlLoremFlickr({ category: 'nature' }) |
| faker.image.unsplash.technology | faker.image.urlLoremFlickr({ category: 'technology' }) |
| faker.image.unsplash.objects | faker.image.urlLoremFlickr({ category: 'objects' }) |
| faker.image.unsplash.buildings | faker.image.urlLoremFlickr({ category: 'buildings' }) |
33 changes: 0 additions & 33 deletions src/modules/image/index.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,6 @@
import type { Faker } from '../..';
import { deprecated } from '../../internal/deprecated';
import { ModuleBase } from '../../internal/module-base';
import type { MethodsOf } from '../../utils/types';
import { LoremPicsum } from './providers/lorempicsum';
import { Placeholder } from './providers/placeholder';
import { Unsplash } from './providers/unsplash';

/**
* Module to generate images.
Expand All @@ -20,35 +16,6 @@ import { Unsplash } from './providers/unsplash';
* This module previously also contained methods for specifically themed images like "fashion" or "food", but these are now deprecated. If you need more control over image type, you can request categorized images using [`urlLoremFlickr()`](https://fakerjs.dev/api/image.html#urlloremflickr), use an image provider directly or provide your own set of placeholder images.
*/
export class ImageModule extends ModuleBase {
/**
* @deprecated Use `faker.image` instead.
*/
// eslint-disable-next-line deprecation/deprecation
readonly unsplash: Unsplash;

/**
* @deprecated Use `faker.image` instead.
*/
// eslint-disable-next-line deprecation/deprecation
readonly lorempicsum: LoremPicsum;

/**
* @deprecated Use `faker.image.urlPlaceholder` instead.
*/
// eslint-disable-next-line deprecation/deprecation
readonly placeholder: Placeholder;

constructor(faker: Faker) {
super(faker);

// eslint-disable-next-line deprecation/deprecation
this.unsplash = new Unsplash(this.faker);
// eslint-disable-next-line deprecation/deprecation
this.lorempicsum = new LoremPicsum(this.faker);
// eslint-disable-next-line deprecation/deprecation
this.placeholder = new Placeholder(this.faker);
}

/**
* Generates a random avatar image url.
*
Expand Down
169 changes: 0 additions & 169 deletions src/modules/image/providers/lorempicsum.ts

This file was deleted.

129 changes: 0 additions & 129 deletions src/modules/image/providers/placeholder.ts

This file was deleted.

Loading