Skip to content

Commit

Permalink
fix: ensure allMetaData is up to date (#81)
Browse files Browse the repository at this point in the history
  • Loading branch information
Zyie authored Sep 3, 2024
1 parent c428b74 commit f4907af
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
8 changes: 5 additions & 3 deletions packages/assetpack/src/core/Asset.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ export class Asset

metaData: Record<string, any> = {};
inheritedMetaData: Record<string, any> = {};
allMetaData: Record<string, any> = {};
transformData: Record<string, any> = {};

settings?: Record<string, any>;
Expand Down Expand Up @@ -63,7 +62,6 @@ export class Asset
asset.parent = this;

asset.inheritedMetaData = { ...this.inheritedMetaData, ...this.metaData };
asset.allMetaData = { ...asset.inheritedMetaData, ...asset.metaData };
asset.transformData = { ...this.transformData, ...asset.transformData };
}

Expand All @@ -87,12 +85,16 @@ export class Asset
asset.transformParent = this;

asset.inheritedMetaData = { ...this.inheritedMetaData, ...this.metaData };
asset.allMetaData = { ...asset.inheritedMetaData, ...asset.metaData };
asset.transformData = { ...this.transformData, ...asset.transformData };

asset.settings = this.settings;
}

get allMetaData()
{
return { ...this.inheritedMetaData, ...this.metaData };
}

get state()
{
return this._state;
Expand Down
3 changes: 1 addition & 2 deletions packages/assetpack/src/webfont/webfont.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,7 @@ export function webfont(): AssetPipe<any, 'wf'>
buffer = fonts.svg.to.woff2(asset.path);
break;
default:
throw new Error(`{Assetpack] Unsupported font type: ${ext}`);
break;
throw new Error(`{AssetPack] Unsupported font type: ${ext}`);
}

const newFileName = asset.filename.replace(/\.(otf|ttf|svg)$/i, '.woff2');
Expand Down

0 comments on commit f4907af

Please sign in to comment.