Use objectMode
This commit is contained in:
parent
80912cb6e2
commit
6e38e2b0d9
|
@ -13,8 +13,7 @@ export default function (manifestName: string) {
|
||||||
const mappings: { [path: string]: string } = {};
|
const mappings: { [path: string]: string } = {};
|
||||||
|
|
||||||
return new Transform({
|
return new Transform({
|
||||||
readableObjectMode: true,
|
objectMode: true,
|
||||||
writableObjectMode: true,
|
|
||||||
transform(chunk: File, _, callback) {
|
transform(chunk: File, _, callback) {
|
||||||
const hash = PRODUCTION ? fileHash(chunk.contents as Buffer) : "00000000";
|
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}`;
|
const newName = `${chunk.basename.substring(0, chunk.basename.length - chunk.extname.length)}.${hash.substring(0, 8)}${chunk.extname}`;
|
||||||
|
|
|
@ -62,8 +62,7 @@ function renderArticle() {
|
||||||
reloadAssets();
|
reloadAssets();
|
||||||
|
|
||||||
return new Transform({
|
return new Transform({
|
||||||
readableObjectMode: true,
|
objectMode: true,
|
||||||
writableObjectMode: true,
|
|
||||||
async transform(file: File, _, callback) {
|
async transform(file: File, _, callback) {
|
||||||
try {
|
try {
|
||||||
const slug = basename(file.path, ".asciidoc");
|
const slug = basename(file.path, ".asciidoc");
|
||||||
|
|
|
@ -13,8 +13,7 @@ const FONT_PRESETS = {
|
||||||
|
|
||||||
function compileFont() {
|
function compileFont() {
|
||||||
return new Transform({
|
return new Transform({
|
||||||
readableObjectMode: true,
|
objectMode: true,
|
||||||
writableObjectMode: true,
|
|
||||||
async transform(chunk: File, _, callback) {
|
async transform(chunk: File, _, callback) {
|
||||||
const [, variant, weight] = /([A-Z][a-z]+)-(\w+)\.ttf$/.exec(chunk.basename);
|
const [, variant, weight] = /([A-Z][a-z]+)-(\w+)\.ttf$/.exec(chunk.basename);
|
||||||
const tmpOutput = tmp.fileSync({ discardDescriptor: true });
|
const tmpOutput = tmp.fileSync({ discardDescriptor: true });
|
||||||
|
|
Loading…
Reference in New Issue
Block a user