From 6e38e2b0d9795ed42db6b445d297bf8114cd2cb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Thibault=20=E2=80=9CAd=C3=A6dra=E2=80=9D=20Hamel?= Date: Mon, 24 Jun 2024 19:41:51 +0200 Subject: [PATCH] Use `objectMode` --- lib/hash.ts | 3 +-- lib/tasks/articles.ts | 3 +-- lib/tasks/fonts.ts | 3 +-- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/hash.ts b/lib/hash.ts index 2dae20a..f177171 100644 --- a/lib/hash.ts +++ b/lib/hash.ts @@ -13,8 +13,7 @@ export default function (manifestName: string) { const mappings: { [path: string]: string } = {}; return new Transform({ - readableObjectMode: true, - writableObjectMode: true, + objectMode: true, transform(chunk: File, _, callback) { const hash = PRODUCTION ? fileHash(chunk.contents as Buffer) : "00000000"; const newName = `${chunk.basename.substring(0, chunk.basename.length - chunk.extname.length)}.${hash.substring(0, 8)}${chunk.extname}`; diff --git a/lib/tasks/articles.ts b/lib/tasks/articles.ts index 5338f11..666e44b 100644 --- a/lib/tasks/articles.ts +++ b/lib/tasks/articles.ts @@ -62,8 +62,7 @@ function renderArticle() { reloadAssets(); return new Transform({ - readableObjectMode: true, - writableObjectMode: true, + objectMode: true, async transform(file: File, _, callback) { try { const slug = basename(file.path, ".asciidoc"); diff --git a/lib/tasks/fonts.ts b/lib/tasks/fonts.ts index 814f8a5..203023b 100644 --- a/lib/tasks/fonts.ts +++ b/lib/tasks/fonts.ts @@ -13,8 +13,7 @@ const FONT_PRESETS = { function compileFont() { return new Transform({ - readableObjectMode: true, - writableObjectMode: true, + objectMode: true, async transform(chunk: File, _, callback) { const [, variant, weight] = /([A-Z][a-z]+)-(\w+)\.ttf$/.exec(chunk.basename); const tmpOutput = tmp.fileSync({ discardDescriptor: true });