Skip to content

Commit

Permalink
chore: use no-const-enum (#94)
Browse files Browse the repository at this point in the history
  • Loading branch information
kyranet committed Apr 20, 2024
1 parent 9a711ea commit 63243c4
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
10 changes: 5 additions & 5 deletions packages/binding/README.md
Expand Up @@ -62,7 +62,7 @@ export interface Metadata {
colorType: JsColorType
}

export const enum JsColorType {
export enum JsColorType {
/** Pixel is 8-bit luminance */
L8 = 0,
/** Pixel is 8-bit luminance with an alpha channel */
Expand Down Expand Up @@ -172,7 +172,7 @@ export interface AvifConfig {
* https://en.wikipedia.org/wiki/Chroma_subsampling#Types_of_sampling_and_subsampling
* https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_concepts
*/
export const enum ChromaSubsampling {
export enum ChromaSubsampling {
/**
* Each of the three Y'CbCr components has the same sample rate, thus there is no chroma subsampling. This scheme is sometimes used in high-end film scanners and cinematic post-production.
* Note that "4:4:4" may instead be wrongly referring to R'G'B' color space, which implicitly also does not have any chroma subsampling (except in JPEG R'G'B' can be subsampled).
Expand Down Expand Up @@ -228,7 +228,7 @@ export interface PngEncodeOptions {
/** Default is `FilterType::NoFilter` */
filterType?: FilterType | undefined | null
}
export const enum CompressionType {
export enum CompressionType {
/** Default compression level */
Default = 0,
/** Fast, minimal compression */
Expand All @@ -240,7 +240,7 @@ export const enum CompressionType {
/** Run-length encoding compression */
Rle = 4,
}
export const enum FilterType {
export enum FilterType {
/**
* No processing done, best used for low bit depth greyscale or data with a
* low color count
Expand Down Expand Up @@ -405,7 +405,7 @@ invert(): this
*/
resize(width: number, height?: number | undefined | null, filterType?: ResizeFilterType | undefined | null): this

export const enum ResizeFilterType {
export enum ResizeFilterType {
/** Nearest Neighbor */
Nearest = 0,
/** Linear Filter */
Expand Down
18 changes: 9 additions & 9 deletions packages/binding/index.d.ts
Expand Up @@ -131,7 +131,7 @@ export interface AvifConfig {
* https://en.wikipedia.org/wiki/Chroma_subsampling#Types_of_sampling_and_subsampling
* https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_concepts
*/
export const enum ChromaSubsampling {
export enum ChromaSubsampling {
/**
* Each of the three Y'CbCr components has the same sample rate, thus there is no chroma subsampling. This scheme is sometimes used in high-end film scanners and cinematic post-production.
* Note that "4:4:4" may instead be wrongly referring to R'G'B' color space, which implicitly also does not have any chroma subsampling (except in JPEG R'G'B' can be subsampled).
Expand Down Expand Up @@ -170,7 +170,7 @@ export const enum ChromaSubsampling {
Yuv400 = 3
}

export const enum CompressionType {
export enum CompressionType {
/** Default compression level */
Default = 0,
/** Fast, minimal compression */
Expand All @@ -183,7 +183,7 @@ export function compressJpeg(input: Buffer, options?: JpegCompressOptions | unde

export function compressJpegSync(input: Buffer, options?: JpegCompressOptions | undefined | null): Buffer

export const enum FastResizeFilter {
export enum FastResizeFilter {
/**
* Each pixel of source image contributes to one pixel of the
* destination image with identical weights. For upscaling is equivalent
Expand Down Expand Up @@ -230,7 +230,7 @@ export interface FastResizeOptions {
fit?: ResizeFit
}

export const enum FilterType {
export enum FilterType {
/**
* No processing done, best used for low bit depth greyscale or data with a
* low color count
Expand Down Expand Up @@ -261,7 +261,7 @@ export interface JpegCompressOptions {
optimizeScans?: boolean
}

export const enum JsColorType {
export enum JsColorType {
/** Pixel is 8-bit luminance */
L8 = 0,
/** Pixel is 8-bit luminance with an alpha channel */
Expand Down Expand Up @@ -297,7 +297,7 @@ export interface Metadata {
colorType: JsColorType
}

export const enum Orientation {
export enum Orientation {
/** Normal */
Horizontal = 1,
MirrorHorizontal = 2,
Expand Down Expand Up @@ -381,7 +381,7 @@ export interface PngQuantOptions {
posterization?: number
}

export const enum PngRowFilter {
export enum PngRowFilter {
None = 0,
Sub = 1,
Up = 2,
Expand Down Expand Up @@ -462,7 +462,7 @@ export const enum PngRowFilter {
* </tr>
* </table>
*/
export const enum ResizeFilterType {
export enum ResizeFilterType {
/** Nearest Neighbor */
Nearest = 0,
/** Linear Filter */
Expand All @@ -475,7 +475,7 @@ export const enum ResizeFilterType {
Lanczos3 = 4
}

export const enum ResizeFit {
export enum ResizeFit {
/**
* (default) Preserving aspect ratio
* ensure the image covers both provided dimensions by cropping/clipping to fit.
Expand Down
4 changes: 2 additions & 2 deletions packages/binding/package.json
Expand Up @@ -54,8 +54,8 @@
},
"scripts": {
"artifacts": "napi artifacts -d ../../artifacts",
"build": "napi build --platform --release",
"build:debug": "napi build --platform",
"build": "napi build --platform --no-const-enum --release",
"build:debug": "napi build --platform --no-const-enum",
"format": "run-p format:prettier format:rs",
"format:prettier": "prettier --config ./package.json -w .",
"format:rs": "cargo fmt --all",
Expand Down
10 changes: 5 additions & 5 deletions website/pages/docs/index.mdx
Expand Up @@ -89,7 +89,7 @@ export interface Metadata {
colorType: JsColorType
}

export const enum JsColorType {
export enum JsColorType {
/** Pixel is 8-bit luminance */
L8 = 0,
/** Pixel is 8-bit luminance with an alpha channel */
Expand Down Expand Up @@ -195,7 +195,7 @@ export interface AvifConfig {
* https://en.wikipedia.org/wiki/Chroma_subsampling#Types_of_sampling_and_subsampling
* https://developer.mozilla.org/en-US/docs/Web/Media/Formats/Video_concepts
*/
export const enum ChromaSubsampling {
export enum ChromaSubsampling {
/**
* Each of the three Y'CbCr components has the same sample rate, thus there is no chroma subsampling. This scheme is sometimes used in high-end film scanners and cinematic post-production.
* Note that "4:4:4" may instead be wrongly referring to R'G'B' color space, which implicitly also does not have any chroma subsampling (except in JPEG R'G'B' can be subsampled).
Expand Down Expand Up @@ -251,7 +251,7 @@ export interface PngEncodeOptions {
/** Default is `FilterType::NoFilter` */
filterType?: FilterType | undefined | null
}
export const enum CompressionType {
export enum CompressionType {
/** Default compression level */
Default = 0,
/** Fast, minimal compression */
Expand All @@ -263,7 +263,7 @@ export const enum CompressionType {
/** Run-length encoding compression */
Rle = 4,
}
export const enum FilterType {
export enum FilterType {
/**
* No processing done, best used for low bit depth greyscale or data with a
* low color count
Expand Down Expand Up @@ -436,7 +436,7 @@ invert(): this
*/
resize(width: number, height?: number | undefined | null, filterType?: ResizeFilterType | undefined | null): this

export const enum ResizeFilterType {
export enum ResizeFilterType {
/** Nearest Neighbor */
Nearest = 0,
/** Linear Filter */
Expand Down

0 comments on commit 63243c4

Please sign in to comment.