index.mjs 457 B

12345678910111213141516171819
  1. export default buffer
  2. import compiler from './compile/html.mjs'
  3. import parser from './parse.mjs'
  4. import postprocess from './postprocess.mjs'
  5. import preprocessor from './preprocess.mjs'
  6. function buffer(value, encoding, options) {
  7. if (typeof encoding !== 'string') {
  8. options = encoding
  9. encoding = undefined
  10. }
  11. return compiler(options)(
  12. postprocess(
  13. parser(options).document().write(preprocessor()(value, encoding, true))
  14. )
  15. )
  16. }