[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-81628":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":12,"subscribersCount":12,"size":12,"stars1d":12,"stars7d":14,"stars30d":15,"stars90d":12,"forks30d":12,"starsTrendScore":12,"compositeScore":16,"rankGlobal":9,"rankLanguage":9,"license":17,"archived":18,"fork":18,"defaultBranch":19,"hasWiki":18,"hasPages":18,"topics":20,"createdAt":9,"pushedAt":9,"updatedAt":21,"readmeContent":22,"aiSummary":23,"trendingCount":12,"starSnapshotCount":12,"syncStatus":15,"lastSyncTime":24,"discoverSource":25},81628,"ansivision","43081j\u002Fansivision","43081j","A library to time-travel through terminal output and more.",null,"TypeScript",24,0,22,1,2,40.7,"MIT License",false,"main",[],"2026-06-12 04:01:34","\u003Cp align=\"center\">\n  \u003Cimg src=\"images\u002Flogo.webp\" alt=\"ansivision\" width=\"480\" \u002F>\n\u003C\u002Fp>\n\n# ansivision\n\nRenders terminal output (i.e. strings containing ANSI codes) into a \"rendered\"\nrepresentation, containing each visual frame which would have been displayed.\n\n##  Why?\n\nWhen working with terminal applications, it can be useful to visualize the output\nas it would appear in a terminal, especially when testing. This library provides\na way to render ANSI strings into their visual representation, allowing you to\nassert on the rendered output in tests or visualize it in other contexts.\n\nA few examples of use cases include:\n\n- Testing the output of a CLI by comparing the rendered frames to\n  snapshots (as opposed to testing raw ANSI strings which can be difficult\n  to read and maintain).\n- Visualizing the output of a terminal application in a web interface or other\n  non-terminal environment.\n- Debugging terminal applications by inspecting the rendered output.\n\n## Installation\n\n```bash\nnpm install ansivision\n```\n\n## Usage\n\n```ts\nimport { renderString } from \"ansivision\";\n\nconst input = \"\\x1b[31mHello\\x1b[0m World\";\nconst rendered = await renderString(input);\n\nfor (const frame of rendered) {\n  \u002F\u002F will render frame 1 which is \"Hello World\"\n  console.log(frame);\n}\n```\n\n## Usage in tests\n\nUsing `renderStringToFrames` to assert on the visual output of a child\nprocess with vitest:\n\n```ts\nimport { test, expect } from \"vitest\";\nimport { renderStringToFrames } from \"ansivision\";\nimport { x } from \"tinyexec\";\n\ntest(\"renders expected output\", async () => {\n  const result = await x('my-command', []);\n\n  const frames = await renderStringToFrames(result.stdout);\n\n  expect(frames).toMatchSnapshot();\n});\n```\n\n> [!NOTE]\n> Many terminal applications will detect if they are running in a non-interactive environment (e.g. a child process) and disable ANSI codes. To ensure that the output contains ANSI codes, you may need to set the `FORCE_COLOR` environment variable to `true` or use a tool to emulate a terminal environment.\n\n## License\n\nMIT\n","ansivision 是一个用于解析和渲染终端输出（包含ANSI转义码的字符串）的库。它能够将这些字符串转换成可视化的帧序列，便于开发者在非终端环境中查看或测试终端应用的输出效果。该库支持TypeScript，提供了如`renderString`等API，可以轻松地将ANSI字符串渲染为一系列视觉帧，适用于CLI应用的测试、调试以及在Web界面或其他非终端环境下展示终端应用的输出。通过与vitest等测试框架结合使用，还可以方便地对命令行工具的输出进行快照测试。","2026-06-11 04:05:46","CREATED_QUERY"]