From f52a8ebfe6b01f26caa4f030d299552d2e1c3f5b Mon Sep 17 00:00:00 2001 From: Fuxing Loh <4266087+fuxingloh@users.noreply.github.com> Date: Mon, 28 Aug 2023 10:41:06 +0800 Subject: [PATCH] feat(contented-pipeline): pipeline transform to include file (#592) #### What this PR does / why we need it: As per title. --- packages/contented-pipeline/src/Pipeline.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/contented-pipeline/src/Pipeline.ts b/packages/contented-pipeline/src/Pipeline.ts index 7be78bad..999a645e 100644 --- a/packages/contented-pipeline/src/Pipeline.ts +++ b/packages/contented-pipeline/src/Pipeline.ts @@ -19,7 +19,7 @@ export interface Pipeline { fields?: { [name: string]: PipelineField; }; - transform?: (file: FileContent) => Promise; + transform?: (file: FileContent, filePath: string) => Promise; sort?: (a: FileIndex, b: FileIndex) => number; } @@ -64,7 +64,7 @@ export abstract class ContentedPipeline { if (this.pipeline.transform === undefined) { return contents; } - return Promise.all(contents.map(this.pipeline.transform)); + return Promise.all(contents.map((content) => this.pipeline.transform!(content, file))); } /**