Skip to content

Commit

Permalink
feat(compress): separate mipmap and compress, and clean up project (#13)
Browse files Browse the repository at this point in the history
* wip

* fix tests

* remove static

* update lock

* combine mipmap and compress into image
  • Loading branch information
Zyie authored Apr 24, 2024
1 parent 7e8c7bd commit b8006c3
Show file tree
Hide file tree
Showing 49 changed files with 435 additions and 416 deletions.
88 changes: 70 additions & 18 deletions package-lock.json

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

2 changes: 0 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,7 @@
"@rollup/plugin-typescript": "^11.0.0",
"@types/fs-extra": "^11.0.1",
"@types/jest": "^29.4.0",
"chokidar": "^3.5.3",
"eslint": "^8.33.0",
"eventemitter3": "^5.0.1",
"find-up": "^5.0.0",
"fs-extra": "^11.1.0",
"husky": "^8.0.3",
Expand Down
5 changes: 3 additions & 2 deletions packages/core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
"merge": "^2.1.1",
"minimatch": "5.1.1",
"object-hash": "3.0.0",
"ora": "^5.4.1",
"cli-progress": "^3.12.0",
"readline": "^1.3.0",
"string-width": "^4.2.3",
"strip-ansi": "^6.0.0",
Expand All @@ -47,7 +47,8 @@
},
"devDependencies": {
"@types/clone": "^2.1.1",
"@types/object-hash": "^3.0.0"
"@types/object-hash": "^3.0.0",
"@types/cli-progress": "3.11.5"
},
"engines": {
"node": ">=16.0.0"
Expand Down
4 changes: 2 additions & 2 deletions packages/core/src/Asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export interface AssetOptions

export class Asset
{
static defaultOptions: AssetOptions = {
private _defaultOptions: AssetOptions = {
path: '',
isFolder: false,
};
Expand Down Expand Up @@ -45,7 +45,7 @@ export class Asset

constructor(options: AssetOptions)
{
options = { ...Asset.defaultOptions, ...options };
options = { ...this._defaultOptions, ...options };

this.path = options.path;
this.isFolder = options.isFolder as boolean;
Expand Down
8 changes: 4 additions & 4 deletions packages/core/src/AssetIgnore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,19 +4,19 @@ import { path } from './utils/path';
export interface AssetIgnoreOptions
{
ignore: string | string[];
basePath: string;
entryPath: string;
}

export class AssetIgnore
{
private _ignore: string[];
private _ignoreHash: Record<string, boolean> = {};
private _basePath: string;
private _entryPath: string;

constructor(options: AssetIgnoreOptions)
{
this._ignore = (Array.isArray(options.ignore) ? options.ignore : [options.ignore]) as string[];
this._basePath = options.basePath;
this._entryPath = options.entryPath;
}

public shouldIgnore(fullPath: string): boolean
Expand All @@ -28,7 +28,7 @@ export class AssetIgnore
_ignoreHash[fullPath] = false;
if (_ignore.length > 0)
{
const relativePath = path.relative(this._basePath, fullPath);
const relativePath = path.relative(this._entryPath, fullPath);

for (let i = 0; i < _ignore.length; i++)
{
Expand Down
Loading

0 comments on commit b8006c3

Please sign in to comment.