From f4907afb103dd3db68d6229f6f774d2128323f47 Mon Sep 17 00:00:00 2001 From: Zyie <24736175+Zyie@users.noreply.github.com> Date: Tue, 3 Sep 2024 09:55:31 +0100 Subject: [PATCH] fix: ensure allMetaData is up to date (#81) --- packages/assetpack/src/core/Asset.ts | 8 +++++--- packages/assetpack/src/webfont/webfont.ts | 3 +-- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/packages/assetpack/src/core/Asset.ts b/packages/assetpack/src/core/Asset.ts index 9c5888e..52aa791 100644 --- a/packages/assetpack/src/core/Asset.ts +++ b/packages/assetpack/src/core/Asset.ts @@ -30,7 +30,6 @@ export class Asset metaData: Record = {}; inheritedMetaData: Record = {}; - allMetaData: Record = {}; transformData: Record = {}; settings?: Record; @@ -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 }; } @@ -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; diff --git a/packages/assetpack/src/webfont/webfont.ts b/packages/assetpack/src/webfont/webfont.ts index 9ec7481..3f56165 100644 --- a/packages/assetpack/src/webfont/webfont.ts +++ b/packages/assetpack/src/webfont/webfont.ts @@ -34,8 +34,7 @@ export function webfont(): AssetPipe 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');