Skip to content

Commit 2687f80

Browse files
authored
refactor: flat folder structure (#27)
1 parent 770c2f2 commit 2687f80

File tree

5 files changed

+4
-5
lines changed

5 files changed

+4
-5
lines changed

src/shared/codecs.ts renamed to src/codecs.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
pngQuantize,
77
} from '@napi-rs/image';
88
import svgo from 'svgo';
9-
import type { Codec, Codecs } from '../types.js';
9+
import type { Codec, Codecs } from './types.js';
1010

1111
export const jpegCodec: Codec<'jpeg'> = {
1212
handler(buf, options) {

src/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
import assert from 'node:assert';
22
import type { RsbuildPlugin } from '@rsbuild/core';
33
import { ImageMinimizerPlugin } from './minimizer.js';
4-
import { withDefaultOptions } from './shared/utils.js';
54
import type { Codecs, Options } from './types.js';
5+
import { withDefaultOptions } from './utils.js';
66

77
export type PluginImageCompressOptions = Options[];
88
export const DEFAULT_OPTIONS: Codecs[] = ['jpeg', 'png', 'ico'];

src/minimizer.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { Buffer } from 'node:buffer';
22
import type { Rspack } from '@rsbuild/core';
3-
import Codecs from './shared/codecs.js';
3+
import Codecs from './codecs.js';
44
import type { FinalOptions } from './types.js';
55

66
export const IMAGE_MINIMIZER_PLUGIN_NAME =

src/shared/utils.ts renamed to src/utils.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import assert from 'node:assert';
2-
import type { FinalOptions, Options } from '../types.js';
32
import codecs from './codecs.js';
3+
import type { FinalOptions, Options } from './types.js';
44

55
export const withDefaultOptions = (opt: Options): FinalOptions => {
66
const options = typeof opt === 'string' ? { use: opt } : opt;

test/basic/index.test.ts

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,6 @@ test('should compress image with use plugin-image-compress', async () => {
5353
expect(avif.length).toBeLessThan(originAvif.length);
5454
expect(webp.length).toBeLessThan(originWebp.length);
5555

56-
console.log(avif.length, originAvif.length);
5756
// TODO ico file size is not less than origin
5857
// expect(outputs[ico].length).toBeLessThan(originIco.length);
5958
});

0 commit comments

Comments
 (0)