{"version":3,"file":"pipeableStream.cjs","sources":["../src/pipeableStream.ts"],"sourcesContent":["import { Transform } from 'node:stream'\n\nimport type { InlineOptions, InlineMinify } from '@twind/core'\n\nimport { createState } from './internal'\n\nexport type { InlineOptions, InlineMinify }\n\nexport default class InlineStream extends Transform {\n  constructor(options?: InlineOptions['tw'] | InlineOptions) {\n    const state = createState(options)\n\n    super({\n      transform(chunk: Buffer, encoding, callback) {\n        if (state.push(chunk.toString())) {\n          this._flush(callback)\n        } else {\n          callback()\n        }\n      },\n      flush(callback) {\n        const markup = state.flush()\n        if (markup) {\n          this.push(markup)\n        }\n        callback()\n      },\n    })\n  }\n}\n"],"names":["InlineStream","Transform","constructor","options","state","createState","transform","chunk","encoding","callback","push","toString","_flush","flush","markup"],"mappings":";;AAQe,IAAMA,eAAN,MAAMA,qBAAqBC,qBAAAA;IACxCC,YAAYC,OAA6C,CAAE;QACzD,IAAMC,QAAQC,oBAAYF,CAAAA;QAE1B,KAAK,CAAC;YACJG,WAAUC,KAAa,EAAEC,QAAQ,EAAEC,QAAQ,EAAE;gBACvCL,MAAMM,IAAI,CAACH,MAAMI,QAAQ,MAC3B,IAAI,CAACC,MAAM,CAACH,YAEZA;YAEJ;YACAI,OAAMJ,QAAQ,EAAE;gBACd,IAAMK,SAASV,MAAMS,KAAK;gBACtBC,UACF,IAAI,CAACJ,IAAI,CAACI;gBAEZL;YACF;QACF;IACF;AACF;"}