end-of-semester-report/node_modules/@unified-latex/unified-latex-util-render-info/index.cjs.map
2025-05-14 16:14:35 +07:00

1 line
1.7 KiB
Plaintext

{"version":3,"file":"index.cjs","sources":["../index.ts"],"sourcesContent":["import * as Ast from \"@unified-latex/unified-latex-types\";\nimport { visit } from \"@unified-latex/unified-latex-util-visit\";\n\n/**\n * Updates the `._renderInfo` property on a node to include\n * whatever has been supplied to `renderInfo`. If `renderInfo`\n * is null, no update is performed.\n *\n * *This operation mutates `node`*\n */\nexport function updateRenderInfo(\n node: Ast.Node | Ast.Argument,\n renderInfo: object | null | undefined\n) {\n if (renderInfo != null) {\n node._renderInfo = { ...(node._renderInfo || {}), ...renderInfo };\n }\n return node;\n}\n\n/**\n * Removes any `_renderInfo` and `position` tags present in the AST. This\n * operation is _destructive_.\n */\nexport function trimRenderInfo<T extends Ast.Ast>(ast: T) {\n visit(ast, (node) => {\n delete node._renderInfo;\n delete node.position;\n });\n return ast;\n}\n\n// NOTE: The docstring comment must be the last item in the index.ts file!\n/**\n * ## What is this?\n *\n * Functions to help modify the `_renderInfo` of a `unified-latex` Abstract Syntax Tree (AST).\n *\n * ## When should I use this?\n *\n * If you want to compare the structure of an AST without position information or extra information\n * that is kept for pretty-printing, these functions can be used to remove/modify the `_renderInfo`\n * of an `Ast.Node`.\n */\n"],"names":["visit"],"mappings":";;;AAUgB,SAAA,iBACZ,MACA,YACF;AACE,MAAI,cAAc,MAAM;AACf,SAAA,cAAc,EAAE,GAAI,KAAK,eAAe,CAAA,GAAK,GAAG,WAAW;AAAA,EAAA;AAE7D,SAAA;AACX;AAMO,SAAS,eAAkC,KAAQ;AAChDA,8BAAA,KAAK,CAAC,SAAS;AACjB,WAAO,KAAK;AACZ,WAAO,KAAK;AAAA,EAAA,CACf;AACM,SAAA;AACX;;;"}