Skip to content

Commit

Permalink
refactor(image)!: remove v8 deprecated providers (#2634)
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Feb 14, 2024
1 parent c96176b commit 44d698e
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 828 deletions.
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.

0 comments on commit 44d698e

Please sign in to comment.