{"version":3,"file":"index.node.cjs","names":["readFileSync","parseHTML","writeFileSync"],"sources":["../src/node.ts"],"sourcesContent":["import type { VHTMLDocument } from './vdom'\nimport { readFileSync, writeFileSync } from 'node:fs'\nimport { parseHTML } from './vdomparser'\n\n/** Manipulate HTMl file directly on disk. Only writes back if there were significant changes. */\nexport function handleHTMLFile(filePath: string, handler: (document: VHTMLDocument) => void, outPath?: string): string {\n  const html = readFileSync(filePath, 'utf-8')\n  const document = parseHTML(html)\n  const htmlIn = document.render()\n  handler(document as VHTMLDocument)\n  const htmlOut = document.render()\n  if (outPath || htmlOut !== htmlIn) {\n    writeFileSync(outPath ?? filePath, htmlOut, 'utf-8')\n    return htmlOut\n  }\n  return html\n}\n"],"mappings":";;;;;;;AAKA,SAAgB,eAAe,UAAkB,SAA4C,SAA0B;CACrH,MAAM,QAAA,GAAOA,QAAAA,aAAAA,CAAa,UAAU,OAAO;CAC3C,MAAM,WAAWC,sBAAAA,UAAU,IAAI;CAC/B,MAAM,SAAS,SAAS,OAAO;CAC/B,QAAQ,QAAyB;CACjC,MAAM,UAAU,SAAS,OAAO;CAChC,IAAI,WAAW,YAAY,QAAQ;EACjCC,CAAAA,GAAAA,QAAAA,cAAAA,CAAc,WAAW,UAAU,SAAS,OAAO;EACnD,OAAO;CACT;CACA,OAAO;AACT"}