merve
brew install merve
v1.2.2_1
Apache-2.0
C++ lexer for extracting named exports from CommonJS modules via static analysis without code execution.
Why you might care
Integrates into Node.js toolchains and bundlers that need to analyze CommonJS export patterns quickly. Fast zero-copy parsing with optional SIMD acceleration, handles complex transpiler output and Unicode, and offers both C++ and C APIs for broad language binding support.
62.4k
30-day installs · #96
239.5k
90-day · #76
239.5k
365-day · #253
56
★ GitHub stars · updated 20d ago
Runtime dependencies
Build dependencies
Links
- https://github.com/nodejs/merve
- GitHub: nodejs/merve
- Brew formula source: Formula/m/merve.rb
Blurb generated by claude-haiku-4-5 on today.
Raw metadata
{
"aliases": [],
"alternatives": [
"cjs-module-lexer",
"acorn",
"@babel/parser"
],
"build_dependencies": [
"cmake"
],
"categories": [
"lexer",
"parser",
"library"
],
"caveats": null,
"conflicts_with": [],
"dependencies": [
"simdutf"
],
"deprecated": 0,
"deprecation_reason": null,
"desc": "C++ lexer for extracting named exports from CommonJS modules",
"disable_reason": null,
"disabled": 0,
"enrichment_fetched_at": "2026-06-20T23:40:39+00:00",
"first_seen": "2026-06-20T23:34:18+00:00",
"full_name": "merve",
"github_default_branch": "main",
"github_last_commit_at": "2026-06-01T06:50:09Z",
"github_readme_excerpt": "# merve\n\nA fast C++ lexer for extracting named exports from CommonJS modules. This library performs static analysis to detect CommonJS export patterns without executing the code.\n\n## Features\n\n- **Fast**: Zero-copy parsing for most exports using `std::string_view`\n- **Accurate**: Handles complex CommonJS patterns including re-exports, Object.defineProperty, and transpiler output\n- **Source Locations**: Each export includes a 1-based line number for tooling integration\n- **Unicode Support**: Properly unescapes JavaScript string literals including `\\u{XXXX}` and surrogate pairs\n- **Optional SIMD Acceleration**: Can use [simdutf](https://github.com/simdutf/simdutf) for faster string operations\n- **C API**: Full C interface (`merve_c.h`) for use from C, FFI, or other languages\n- **No Dependencies**: Single-header distribution available (simdutf is optional)\n- **Cross-Platform**: Works on Linux, macOS, and Windows\n\n## Installation\n\n### CMake\n\n```cmake\ninclude(FetchContent)\nFetchContent_Declare(\n merve\n GIT_REPOSITORY https://github.com/anonrig/merve.git\n GIT_TAG main\n)\nFetchContent_MakeAvailable(merve)\n\ntarget_link_libraries(your_target PRIVATE lexer::lexer)\n```\n\n### Single Header\n\nCopy `singleheader/merve.h` and `singleheader/merve.cpp` to your project.\nThe C API header `singleheader/merve_c.h` is also included in the distribution.\n\n## Usage\n\n```cpp\n#include \"merve.h\"\n#include \u003ciostream\u003e\n\nint main() {\n std::string_view source = R\"(\n exports.foo = 1;\n exports.bar = function() {};\n module.exports.baz = \u0027hello\u0027;\n )\";\n\n auto result = lexer::parse_commonjs(source);\n \n if (result) {\n std::cout \u003c\u003c \"Exports found:\" \u003c\u003c std::endl;\n for (const auto\u0026 exp : result-\u003eexports) {\n std::cout \u003c\u003c \" - \" \u003c\u003c lexer::get_string_view(exp)\n \u003c\u003c \" (line \" \u003c\u003c exp.line \u003c\u003c \")\" \u003c\u003c std::endl;\n }\n }\n\n return 0;\n}\n```\n\nOutput:\n```\nExports found:\n - foo (line 2)\n - bar (line 3)\n - baz (line 4)\n```\n\n## API Reference\n\n### `lexer::parse_commonjs`\n\n```cpp\nstd",
"github_repo": "nodejs/merve",
"github_stars": 56,
"github_topics": [],
"homepage": "https://github.com/nodejs/merve",
"homepage_og_description": null,
"homepage_og_image": null,
"homepage_title": null,
"installs_30d": 62377,
"installs_365d": 239513,
"installs_90d": 239513,
"keg_only": 0,
"keg_only_reason": null,
"last_seen": "2026-06-20T23:34:18+00:00",
"license": "Apache-2.0",
"llm_generated_at": "2026-06-20T23:42:41+00:00",
"llm_model": "claude-haiku-4-5",
"name": "merve",
"oldnames": [],
"one_liner": "C++ lexer for extracting named exports from CommonJS modules via static analysis without code execution.",
"optional_dependencies": [],
"rank_30d": 96,
"rank_365d": 253,
"rank_90d": 76,
"raw_hash": "39de30c30a1529d3",
"recommended_dependencies": [],
"revision": 1,
"ruby_source_path": "Formula/m/merve.rb",
"tap": "homebrew/core",
"test_dependencies": [],
"uses_from_macos": [],
"version_head": null,
"version_stable": "1.2.2",
"versioned_formulae": [],
"why_use_this": "Integrates into Node.js toolchains and bundlers that need to analyze CommonJS export patterns quickly. Fast zero-copy parsing with optional SIMD acceleration, handles complex transpiler output and Unicode, and offers both C++ and C APIs for broad language binding support."
}